Ejemplo n.º 1
0
 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 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");
        }
        if (!IsPostBack)
        {
            drp_post.Items.Add(new ListItem("Select Post", "0", true));

            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();
            ds.Clear();
        }
    }
Ejemplo n.º 3
0
    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");
                    }
                }
            }
        }
    }