protected void Page_Load(object sender, EventArgs e)
    {
        if (Convert.ToString(Session["reg_id"]) == "")
        {
            Response.Redirect("stu_login.aspx");
        }
        if (Convert.ToString(Session["cnd_id"]) != "")
        {
            Response.Redirect("stu_cnd_view.aspx");
        }
        else
        {
            int reg_id = Convert.ToInt32(Session["reg_id"]);

            DataSet ds = bl.get_candidate_reg_id(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();
                    Response.Redirect("stu_cnd_view.aspx");
                }
                else if (Convert.ToInt32(ds.Tables[0].Rows[0]["active"]) == 0)
                {
                    lbl_request.Visible = true;
                    lbl_not_eligible.Visible = false;
                }
                else
                {
                    lbl_not_eligible.Visible = true;
                    lbl_request.Visible = false;
                }
            }
            else
            {
                Response.Redirect("stu_cnd_reg.aspx");
            }
        }
    }
Exemple #2
0
    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>");
        }
    }