static int tmpStartmin = 0; static int tmpStartSecond = 59; protected void SetExamTimer() { Timer1.Enabled = false; if (Session["QStartTime"] == null) Session.Add("QStartTime", DateTime.Now); else Session["QStartTime"] = DateTime.Now; SqlConnection sqcontime = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionStr"].ConnectionString); string sqtime = ""; DataTable dtt = new DataTable(); sqtime = "Select Top 1 * from TimeLog Where QuestionPaper_ID=" + int.Parse(Session["QuesPaper_ID"].ToString()) + " and Registration_ID=" + int.Parse(Session["RegistrationID"].ToString()) + " and isdeleted=0 Order by Timelog_Id desc "; SqlDataAdapter adptime = new SqlDataAdapter(sqtime, sqcontime); adptime.Fill(dtt); if (dtt.Rows.Count > 0) { divTime.Visible = true; Timer1.Enabled = true; if (Session["QStartTime"] == null) Session.Add("QStartTime", DateTime.Now); else Session["QStartTime"] = DateTime.Now; lblTime.Text = dtt.Rows[0]["Time"].ToString(); tmpStartmin = Convert.ToInt32(dtt.Rows[0]["Min"].ToString()); tmpStartSecond = Convert.ToInt32(dtt.Rows[0]["Sec"].ToString()); lblMinute.Text = tmpStartmin.ToString(); lblSeconds.Text = tmpStartSecond.ToString(); } else { string sqq = ""; DataTable dt = new DataTable(); sqq = "Select * from StDetail Where QuestionPaper_ID=" + int.Parse(Session["QuesPaper_ID"].ToString()) + " and isdeleted=0"; SqlDataAdapter dq = new SqlDataAdapter(sqq, System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionStr"].ConnectionString); dq.Fill(dt); if (dt.Rows.Count > 0) { divTime.Visible = true; Timer1.Enabled = true; if (Session["QStartTime"] == null) Session.Add("QStartTime", DateTime.Now); else Session["QStartTime"] = DateTime.Now; lblTime.Text = dt.Rows[0]["FixedExamTime"].ToString(); tmpStartmin = Convert.ToInt32(dt.Rows[0]["FixedExamTime"].ToString()) - 1; lblMinute.Text = tmpStartmin.ToString(); lblSeconds.Text = tmpStartSecond.ToString(); } else { divTime.Visible = false; Timer1.Enabled = false; if (Session["QStartTime"] == null) Session.Add("QStartTime", DateTime.Now); else Session["QStartTime"] = DateTime.Now; } } }
protected void SetExamTimer() { tmpStartmin=0; tmpStartSecond = 59;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)