protected void ddlClass_OnSelectedIndexChanged(object sender, EventArgs e) { try { if (ddlClass.SelectedValue != "") { ApplicationResult objResult = new ApplicationResult(); ClassBL objClassBl = new ClassBL(); objResult = objClassBl.Class_Select(Convert.ToInt32(ddlClass.SelectedValue)); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { hfNoOfPeriod.Value = objResult.resultDT.Rows[0][ClassBO.CLASS_NOOFPERIOD].ToString(); } } if (ViewState["DropDownMode"].ToString() == "Load") { BindPeriod(); } else if (ViewState["DropDownMode"].ToString() == "New") { BindDays(Convert.ToInt32(ddlClass.SelectedValue), 2); int intcount = Convert.ToInt32(hfNoOfPeriod.Value); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>BindPeriod(" + intcount + ");</script>"); } } else { gvPeriod.DataSource = null; gvPeriod.DataBind(); } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
protected void ddlClass_OnSelectedIndexChanged(object sender, EventArgs e) { try { if (ddlClass.SelectedValue != "") { ApplicationResult objResult = new ApplicationResult(); ClassBL objClassBl = new ClassBL(); TimeTableBL objTimeTableBl = new TimeTableBL(); objResult = objTimeTableBl.TimeTable_Validate_Period(Convert.ToInt32(ddlClass.SelectedValue)); if (objResult.resultDT.Rows[0][0].ToString() == "0") { objResult = objClassBl.Class_Select(Convert.ToInt32(ddlClass.SelectedValue)); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { hfNoOfPeriod.Value = objResult.resultDT.Rows[0][ClassBO.CLASS_NOOFPERIOD].ToString(); } } BindDivision(Convert.ToInt32(ddlClass.SelectedValue)); } else { ddlDivision.Items.Clear(); ddlDivision.Items.Insert(0, new ListItem("--Select--", "")); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('First you have to insert data in period.');</script>"); } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
protected void gvStudent_RowCommand(object sender, GridViewCommandEventArgs e) { try { btnSave.Enabled = true; btnSave.Attributes.Add("bgcolor", "#848484"); Controls objControls = new Controls(); StudentBL objStudentBL = new StudentBL(); ApplicationResult objResults = new ApplicationResult(); if (e.CommandName.ToString() == "Edit1") { ViewState["StudentMID"] = Convert.ToInt32(e.CommandArgument.ToString()); objResults = objStudentBL.Student_Select(Convert.ToInt32(ViewState["StudentMID"].ToString()), 0); if (objResults != null) { if (objResults.resultDT.Rows.Count > 0) { ViewState["DivisionName"] = objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTDIVISIONTID].ToString(); #region Find DivisionName DivisionTBL objDivision = new DivisionTBL(); ApplicationResult objResultsDivision = new ApplicationResult(); objResultsDivision = objDivision.DivisionT_Select_By_DivisionTID(Convert.ToInt32(objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTDIVISIONTID].ToString())); if (objResultsDivision != null) { if (objResultsDivision.resultDT.Rows.Count > 0) { ViewState["Division"] = objResultsDivision.resultDT.Rows[0][DivisionTBO.DIVISIONT_DIVISIONNAME].ToString(); } } #endregion #region Find SectionName SectionBL objSection = new SectionBL(); ApplicationResult objResultsSection = new ApplicationResult(); objResultsSection = objSection.Section_Select(Convert.ToInt32(objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTSECTIONID].ToString())); if (objResultsSection != null) { if (objResultsSection.resultDT.Rows.Count > 0) { ViewState["SectionName"] = objResultsSection.resultDT.Rows[0][SectionBO.SECTION_SECTIONNAME].ToString(); } } #endregion #region Find Class ClassBL objClass = new ClassBL(); ApplicationResult objResultsClass = new ApplicationResult(); objResultsClass = objClass.Class_Select(Convert.ToInt32(objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTCLASSID].ToString())); if (objResultsClass != null) { if (objResultsClass.resultDT.Rows.Count > 0) { ViewState["ClassMID"] = objResultsClass.resultDT.Rows[0][ClassBO.CLASS_CLASSMID].ToString(); ViewState["ClassName"] = objResultsClass.resultDT.Rows[0][ClassBO.CLASS_CLASSNAME].ToString(); } } #endregion ViewState["AcademicYear"] = objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTYEAR].ToString(); } } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
protected void gvClass_RowCommand(object sender, GridViewCommandEventArgs e) { try { ViewState["ClassMID"] = e.CommandArgument.ToString(); Controls objControls = new Controls(); ClassBL objClasstBl = new ClassBL(); ApplicationResult objResults = new ApplicationResult(); DivisionTBL objDivisionBl = new DivisionTBL(); if (e.CommandName.ToString() == "Edit1") { objResults = objClasstBl.Class_Select(Convert.ToInt32(ViewState["ClassMID"].ToString())); if (objResults != null) { if (objResults.resultDT.Rows.Count > 0) { ddlSection.SelectedValue = objResults.resultDT.Rows[0][ClassBO.CLASS_SECTIONTID].ToString(); txtClassName.Text = objResults.resultDT.Rows[0][ClassBO.CLASS_CLASSNAME].ToString(); txtApprovalNo.Text = objResults.resultDT.Rows[0][ClassBO.CLASS_APPROVALNO].ToString(); txtApprovalDate.Text = objResults.resultDT.Rows[0][ClassBO.CLASS_APPROVALDATE].ToString(); txtNoOfPeriod.Text = objResults.resultDT.Rows[0][ClassBO.CLASS_NOOFPERIOD].ToString(); objResults = objDivisionBl.DivisionT_Select_DivisionName_By_Class(Convert.ToInt32(ViewState["ClassMID"].ToString())); if (objResults != null) { // ViewState["Division"] = objResults.resultDT; // gvDivision.DataSource = (DataTable)ViewState["Division"]; gvDivision.DataSource = objResults.resultDT; gvDivision.DataBind(); } ViewState["Mode"] = "Edit"; PanelGrid_VisibilityMode(2); } } } if (e.CommandName.ToString() == "Delete1") { //objControls.EnableControls(Master.FindControl("ContentPlaceHolder1")); //ApplicationResult objDelete = new ApplicationResult(); //objDelete = objClasstBl.Validate_Class_Delete(Convert.ToInt32(ViewState["ClassMID"].ToString()), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), ViewState["DivisionName"].ToString()); //if (objDelete != null) //{ // if (objDelete.resultDT.Rows.Count > 0) // { // if (Convert.ToInt32(objDelete.resultDT.Rows[0]["CurrentClassID"]) == Convert.ToInt32(ViewState["ClassMID"].ToString())) // { // ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('There are Student(s) associated with this Class. To delete this Section you need to delete Student(s) first.');</script>"); // } // } // else // { // objResults = objClasstBl.Class_Delete(Convert.ToInt32(e.CommandArgument.ToString()), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), ViewState["DivisionName"].ToString()); // if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) // { // ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Class deleted successfully.');</script>"); // ClearAll(); // GridDataBind(); // PanelGrid_VisibilityMode(1); // } // } //} ApplicationResult objResult = new ApplicationResult(); ClassBL objClassBl = new ClassBL(); objResult = objClassBl.Class_Delete(Convert.ToInt32(ViewState["ClassMID"].ToString()), Convert.ToInt32(Session[ApplicationSession.SCHOOLID])); if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Class deleted successfully.');</script>"); GridDataBind(); } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('There are Student(s) associated with this Class. To delete this Section you need to delete Student(s) first.');</script>"); } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
protected void gvStudent_RowCommand(object sender, GridViewCommandEventArgs e) { try { Controls objControls = new Controls(); StudentBL objStudentBL = new StudentBL(); ApplicationResult objResults = new ApplicationResult(); if (e.CommandName.ToString() == "Edit1") { ViewState["StudentMID"] = Convert.ToInt32(e.CommandArgument.ToString()); divStudentPanel.Visible = true; objResults = objStudentBL.Student_Select(Convert.ToInt32(ViewState["StudentMID"].ToString()), 0); divStudentPanel.Visible = true; if (objResults != null) { if (objResults.resultDT.Rows.Count > 0) { ViewState["DivisionName"] = objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTDIVISIONTID].ToString(); #region Find DivisionName DivisionTBL objDivision = new DivisionTBL(); ApplicationResult objResultsDivision = new ApplicationResult(); objResultsDivision = objDivision.DivisionT_Select_By_DivisionTID(Convert.ToInt32(objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTDIVISIONTID].ToString())); if (objResultsDivision != null) { if (objResultsDivision.resultDT.Rows.Count > 0) { ViewState["Division"] = objResultsDivision.resultDT.Rows[0][DivisionTBO.DIVISIONT_DIVISIONNAME].ToString(); } } #endregion #region Find SectionName SectionBL objSection = new SectionBL(); ApplicationResult objResultsSection = new ApplicationResult(); objResultsSection = objSection.Section_Select(Convert.ToInt32(objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTSECTIONID].ToString())); if (objResultsSection != null) { if (objResultsSection.resultDT.Rows.Count > 0) { ViewState["SectionName"] = objResultsSection.resultDT.Rows[0][SectionBO.SECTION_SECTIONNAME].ToString(); } } #endregion #region Find Class ClassBL objClass = new ClassBL(); ApplicationResult objResultsClass = new ApplicationResult(); objResultsClass = objClass.Class_Select(Convert.ToInt32(objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTCLASSID].ToString())); if (objResultsClass != null) { if (objResultsClass.resultDT.Rows.Count > 0) { ViewState["ClassMID"] = objResultsClass.resultDT.Rows[0][ClassBO.CLASS_CLASSNAME].ToString(); } } #endregion lblAdmissionNo.Text = objResults.resultDT.Rows[0][StudentBO.STUDENT_ADMISSIONNO].ToString(); lblCurrentGrNo.Text = objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTGRNO].ToString(); lblStudentNameEng.Text = objResults.resultDT.Rows[0][StudentBO.STUDENT_STUDENTLASTNAMEENG].ToString() + " " + objResults.resultDT.Rows[0][StudentBO.STUDENT_STUDENTFIRSTNAMEENG].ToString() + " " + objResults.resultDT.Rows[0][StudentBO.STUDENT_STUDENTMIDDLENAMEENG].ToString(); lblClassDivision.Text = ViewState["ClassMID"].ToString() + "-" + ViewState["Division"].ToString(); lblCurrentSection.Text = ViewState["SectionName"].ToString(); lblAcademicYear.Text = objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTYEAR].ToString(); ViewState["AcademicYear"] = objResults.resultDT.Rows[0][StudentBO.STUDENT_CURRENTYEAR].ToString(); } } GridDataBind(); } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }