Archive for July 15th, 2008
A store procedure for microsoft sql to check win
This procedure use time… month and day
CREATE procedure sp_update_WinHands
@month as nvarchar(10) ,
@day as nvarchar(10)
as
declare @win as float
declare @lose as float
DECLARE @hand INT
declare @query nvarchar(1000)
declare @check as int
set @check=( select count(tableid) from bethistory where month1=@month and day1= @day)
if ( @check=0 )
begin
insert into bethistory(month1,day1) values (@month,@day)
end
SET @hand = 1
WHILE (@hand <=12)
BEGIN
set @win = (select count(id) from BetHeader
where datepart(m,dt)=@month and datepart(d,dt)=@day
and case when lasthand>@hand then 1 else 0 end=1)
set @lose = (select count(id) from BetHeader
where datepart(m,dt)=@month and datepart(d,dt)=@day
and case when lasthand>@hand then 1 else 0 end=0)
if( @win=0 ) begin set @win=1 end
set @query= ‘update bethistory set h’+cast(@hand as nvarchar(10))+’='+cast(@lose as nvarchar(10))+’.00/’+cast(@win as nvarchar(10))+’.00 where month1=’+@month+’ and day1= ‘+@day+”
exec ( @query )
SET @hand = @hand + 1
END
GO
Add comment July 15, 2008
Check log every 5 min in C#
where timerticlickvoid is the click of the timer….
public void timertickvoid()
{
// Set the timer interval to 5 minutes
timerCheck.Interval = (int)(5 * 1000 * 60);
FileStream fs = File.OpenRead(“timer.log”);
StreamReader sr = new StreamReader(fs);
string myInput = sr.ReadToEnd();
sr.Close();
fs.Close();
DateTime dtFile = Convert.ToDateTime(myInput);
DateTime dt2 = DateTime.Now;
TimeSpan span = dt2.Subtract(dtFile);
int dif = span.Days*60*24 + span.Hours*60+span.Minutes;
if (dif > 5)//>60
{
RunRoutines();
}
}
Add comment July 15, 2008