private void timer1_Tick(object sender, EventArgs e) { if (seconds > 0) { seconds--; } else { if (betweenRounds) { betweenRounds = false; } else { if (FormLogin.virtualDate.CompareTo(currentRound.DateTo) > 0) { timer1.Stop(); /* se nagraduvaat tipsterite koi pogodile */ using (OracleConnection conn = new OracleConnection(FormLogin.connString)) { conn.Open(); string query = "select * from computegain where validated = 'n' AND idRound <= " + currentRound.Id; OracleCommand command = new OracleCommand(query, conn); command.CommandType = CommandType.Text; OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { ComputeGain gain = new ComputeGain(reader.GetInt32(0), reader.GetInt32(1), reader.GetString(2), reader.GetInt32(3), Double.Parse(reader[4].ToString()), reader.GetInt32(5), reader.GetInt32(6), reader.GetInt32(7), reader.GetInt32(8), reader.GetString(9)); if (gain.IsWinning()) { string up = "update tipster set money = money + " + (int)gain.GetGain() + " WHERE idTipster = " + gain.IdTipster; OracleCommand comm2 = new OracleCommand(up,conn); comm2.CommandType = CommandType.Text; comm2.ExecuteNonQuery(); } } query = "update tips set validated = 'y' where idTips IN (select idTips from computegain where validated = 'n' AND idRound <= " + currentRound.Id + " )"; command = new OracleCommand(query, conn); command.CommandType = CommandType.Text; command.ExecuteNonQuery(); reader.Close(); } if (frmRounds != null) { frmRounds.cbRounds_SelectedIndexChanged(null, null); } initializeCountdown(); return; } } if (frmRounds != null) { frmRounds.cbRounds_SelectedIndexChanged(null, null); } } initLabel(); initLblDate(); }
private void timer1_Tick(object sender, EventArgs e) { if (seconds > 0) { seconds--; } else { if (betweenRounds) { betweenRounds = false; } else { if (FormLogin.virtualDate.CompareTo(currentRound.DateTo) > 0) { timer1.Stop(); /* se nagraduvaat tipsterite koi pogodile */ using (OracleConnection conn = new OracleConnection(FormLogin.connString)) { conn.Open(); string query = "select * from computegain where validated = 'n' AND idRound <= " + currentRound.Id; OracleCommand command = new OracleCommand(query, conn); command.CommandType = CommandType.Text; OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { ComputeGain gain = new ComputeGain(reader.GetInt32(0), reader.GetInt32(1), reader.GetString(2), reader.GetInt32(3), Double.Parse(reader[4].ToString()), reader.GetInt32(5), reader.GetInt32(6), reader.GetInt32(7), reader.GetInt32(8), reader.GetString(9)); if (gain.IsWinning()) { string up = "update tipster set money = money + " + (int)gain.GetGain() + " WHERE idTipster = " + gain.IdTipster; OracleCommand comm2 = new OracleCommand(up, conn); comm2.CommandType = CommandType.Text; comm2.ExecuteNonQuery(); } } query = "update tips set validated = 'y' where idTips IN (select idTips from computegain where validated = 'n' AND idRound <= " + currentRound.Id + " )"; command = new OracleCommand(query, conn); command.CommandType = CommandType.Text; command.ExecuteNonQuery(); reader.Close(); } if (frmRounds != null) { frmRounds.cbRounds_SelectedIndexChanged(null, null); } initializeCountdown(); return; } } if (frmRounds != null) { frmRounds.cbRounds_SelectedIndexChanged(null, null); } } initLabel(); initLblDate(); }