protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["es_id"] == null) { lbl_msg.Text = es_not_declare; lbl_msg.ForeColor = Color.Red; drp_post.Visible = false; } else { BLayer.CollegeAdmin clg_ad_obj = new BLayer.CollegeAdmin(); int clg_id = Convert.ToInt32(Session["clg_id"]); DataSet ds = bl.get_post(); ds.Tables[0].DefaultView.Sort = "post_name"; drp_post.DataSource = ds.Tables[0]; drp_post.DataTextField = "post_name"; drp_post.DataValueField = "post_id"; drp_post.DataBind(); drp_post.Visible = true; ds.Clear(); } } }
protected void btn_login_Click(object sender, EventArgs e) { DataSet ds = bl.get_student(txt_enroll_no.Text, txt_pswd.Text); if (ds.Tables[0].Rows.Count > 0) { Session["reg_id"] = ds.Tables[0].Rows[0][0].ToString(); Session["enroll_no"] = ds.Tables[0].Rows[0][1].ToString(); Session["fn"] = ds.Tables[0].Rows[0][2].ToString(); Session["ln"] = ds.Tables[0].Rows[0][3].ToString(); int clg_id = Convert.ToInt32(ds.Tables[0].Rows[0]["clg_id"]); Session["clg_id"] = clg_id.ToString(); Session["email"] = ds.Tables[0].Rows[0][11].ToString(); ds.Clear(); ds = bl.get_candidate_reg_id(Convert.ToInt32(Session["reg_id"])); if (ds.Tables[0].Rows.Count > 0) { if (Convert.ToInt32(ds.Tables[0].Rows[0]["active"]) == 1) { Session["cnd_id"] = ds.Tables[0].Rows[0]["cnd_id"].ToString(); } } BLayer.CollegeAdmin clg_ad_obj = new BLayer.CollegeAdmin(); ds = clg_ad_obj.getElectionSchedule_by_clg_id(clg_id); if (ds.Tables[0].Rows.Count > 0) { Session["es_id"] = ds.Tables[0].Rows[0]["es_id"].ToString(); } ds.Clear(); Response.Redirect("stu_vote.aspx"); } else { Response.Write("<script>alert('Invalid Email or Password')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["es_id"] == null) { lbl_msg.Text = es_not_declare; lbl_msg.ForeColor = Color.Red; drp_post.Visible = false; } else { BLayer.CollegeAdmin clg_ad_obj = new BLayer.CollegeAdmin(); string year = DateTime.Now.Year.ToString(); string month = DateTime.Now.Month.ToString(); if (Convert.ToInt32(month) < 10) { month = "0" + month; } string day = DateTime.Now.Day.ToString(); if (Convert.ToInt32(day) < 10) { day = "0" + day; } string minute = DateTime.Now.TimeOfDay.Minutes.ToString(); if (Convert.ToInt32(minute) < 10) { minute = "0" + minute; } string hour = DateTime.Now.TimeOfDay.Hours.ToString(); if (Convert.ToInt32(hour) < 10) { hour = "0" + hour; } string date = year + "-" + month + "-" + day; string time = hour + ":" + minute; int clg_id = Convert.ToInt32(Session["clg_id"]); DataSet ds = clg_ad_obj.getElectionSchedule_by_clg_id_date(clg_id, date, time); if (ds.Tables[0].Rows.Count > 0) { ds = bl.get_post(); ds.Tables[0].DefaultView.Sort = "post_name"; drp_post.DataSource = ds.Tables[0]; drp_post.DataTextField = "post_name"; drp_post.DataValueField = "post_id"; drp_post.DataBind(); drp_post.Visible = true; ds.Clear(); } else { int i = clg_ad_obj.checkElectionScheduleResult(clg_id, date, time); if (i == 0) { lbl_msg.Text = voting_soon; lbl_msg.ForeColor = Color.ForestGreen; drp_post.Visible = false; ds.Clear(); } else if (i == 1) { Response.Redirect("stu_final_result.aspx"); } } } } }