protected void Page_Load(object sender, EventArgs e) { if (Session["UserId"] == null) { Response.Redirect(System.Web.Security.FormsAuthentication.LoginUrl.ToString() + "?ReturnUrl=" + Request.RawUrl.ToString()); } if (!IsPostBack) { try { if (Session["SchoolId"] != null && Session["ClassId"] != null) //Application["SchoolId"] != null && Application["ClassId"] != null) { ddlSchool.SelectedValue = Session["SchoolId"].ToString(); ddlSchool.DataTextField = "School"; ddlSchool.DataValueField = "SchoolId"; ddlSchool.DataBind(); ddlClass.SelectedValue = Session["ClassId"].ToString(); ddlClass.DataTextField = "Class"; ddlClass.DataValueField = "classid"; ddlClass.DataBind(); ddlClass_SelectedIndexChanged(sender, e); } if (Session["UserRoleId"].ToString() == "5") { DataTable dt = objStudent.GetSchoolInfo(Convert.ToInt32(Session["UserId"])); if (dt.Rows.Count > 0) { h1_ClassSchool.InnerHtml += "- " + dt.Rows[0]["Class"].ToString() + " " + dt.Rows[0]["School"].ToString(); } } #region Restrict Upload //int cityid = 0; //int classid = 0; //DataTable ds = objStudent.GetCurrentStageByClass(Convert.ToInt32(ddlClass.SelectedValue)); //int CompleteLegs = 0; //if (ds != null && ds.Rows.Count > 0) //{ // CompleteLegs = objStudent.GetCompleteLegCount(Convert.ToInt32(ds.Rows[0]["ClassId"].ToString())); // if (ds != null && ds.Rows.Count > 0) // { // cityid = Convert.ToInt32(ds.Rows[0]["FromCityId"].ToString()); // classid = Convert.ToInt32(ds.Rows[0]["ClassId"].ToString()); // } //} //if (cityid > 0 && classid > 0) //{ // DataTable dt = objStudent.GetQuizResult(classid, cityid); // if (dt.Rows.Count > 0 || CompleteLegs == 0) // { // } // else // { // btn_Upload.Enabled = false; // btn_Upload.CssClass = "disabled"; // lblMessage.Text = "No student have passed test for current leg.<br/>"; // lblMessage.Visible = true; // } //} #endregion } catch { } } if (grd_Uploads.Rows.Count > 0) { btn_SaveGrid.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserId"] == null) { Response.Redirect(System.Web.Security.FormsAuthentication.LoginUrl.ToString() + "?ReturnUrl=" + Request.RawUrl.ToString()); } if (!IsPostBack) { try { DataTable dsStud = objStudent.GetStudentInfo(Convert.ToInt32(Session["UserId"])); if (Convert.ToBoolean(dsStud.Rows[0]["isUploadBlock"]) == true) { // Server.Transfer("Page2.aspx", true); dsStud.Dispose(); Response.Redirect("HtmlForum.aspx"); } if (Session["UserRoleId"].ToString() == "5") { DataTable dt = objStudent.GetSchoolInfo(Convert.ToInt32(Session["UserId"])); if (dt.Rows.Count > 0) { h1_ClassSchool.InnerHtml += "- " + dt.Rows[0]["Class"].ToString() + " " + dt.Rows[0]["School"].ToString(); } } #region Restrict Upload //int cityid = 0; //int classid = 0; //DataSet ds = objStudent.GetCurrentStageInfo(Convert.ToInt32(Session["UserId"].ToString()), Convert.ToInt32(Session["UserRoleId"].ToString()), 0); //int CompleteLegs = 0; //if (ds != null && ds.Tables.Count > 0) //{ // CompleteLegs = objStudent.GetCompleteLegCount(Convert.ToInt32(ds.Tables[0].Rows[0]["ClassId"].ToString())); // if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) // { // cityid = Convert.ToInt32(ds.Tables[0].Rows[0]["StartCityId"].ToString()); // classid = Convert.ToInt32(ds.Tables[0].Rows[0]["ClassId"].ToString()); // } //} //if (cityid > 0 && classid > 0) //{ // DataTable dt = objStudent.GetQuizResult(classid, cityid); // if (dt.Rows.Count > 0 || CompleteLegs == 0) // { // } // else // { // btn_Upload.Enabled = false; // btn_Upload.CssClass = "disabled"; // lblMessage.Text = "Your next leg of Stage plan is not started yet, wait till next leg begins.<br/>"; // lblMessage.Visible = true; // } //} #endregion } catch { } } }