protected void btnSaveClass_OnClick(object sender, EventArgs e) { try { ApplicationResult objResult = new ApplicationResult(); TimeTableBO objTimeTableBo = new TimeTableBO(); TimeTableBL objTimeTableBl = new TimeTableBL(); for (int i = 1; i <= Convert.ToInt32(hfNoOfPeriod.Value); i++) { Label lbl = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblPeriod" + i.ToString()) as Label; DropDownList ddl1 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("ddlSubject" + i.ToString()) as DropDownList; DropDownList ddl2 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("ddlTeacher" + i.ToString()) as DropDownList; objTimeTableBo.PeriodID = Convert.ToInt32(lbl.Text); objTimeTableBo.SubjectMID = Convert.ToInt32(ddl1.SelectedValue); objTimeTableBo.EmployeeMID = Convert.ToInt32(ddl2.SelectedValue); objResult = objTimeTableBl.TimeTable_Insert(objTimeTableBo, Convert.ToInt32(ddlClass.SelectedValue), Convert.ToInt32(ddlDivision.SelectedValue), Convert.ToInt32(Session[ApplicationSession.USERID].ToString()), DateTime.UtcNow.AddHours(5.5).ToString()); } BindTimeTable(); PanelVisibility(1); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record saved successfully.');</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 ddlDay_OnSelectedIndexChanged(object sender, EventArgs e) { try { if (ddlDay.SelectedValue != "") { ApplicationResult objResult = new ApplicationResult(); TimeTableBL objTimeTableBl = new TimeTableBL(); objResult = objTimeTableBl.TimeTable_Select_By_Class_Division_Day(Convert.ToInt32(ddlClass.SelectedValue), Convert.ToInt32(ddlDivision.SelectedValue), Convert.ToInt32(ddlDay.SelectedValue)); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { for (int i = 0, j = 1; i < Convert.ToInt32(hfNoOfPeriod.Value); i++, j++) { Label lbl = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblPeriod" + j.ToString()) as Label; DropDownList ddl1 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("ddlSubject" + j.ToString()) as DropDownList; DropDownList ddl2 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("ddlTeacher" + j.ToString()) as DropDownList; lbl.Text = objResult.resultDT.Rows[i]["PeriodID"].ToString(); ddl1.SelectedValue = objResult.resultDT.Rows[i]["SubjectMID"].ToString(); ddlSubject_OnSelectedIndexChanged(ddl1, e); ddl2.SelectedValue = objResult.resultDT.Rows[i]["TeacherID"].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>"); } }
public void BindTimeTable() { ApplicationResult objResult = new ApplicationResult(); TimeTableBL objSchoolBL = new TimeTableBL(); objResult = objSchoolBL.TeacherWise_TimeTable(Convert.ToInt32(Session[ApplicationSession.SCHOOLID].ToString()), Convert.ToInt32(hfEmployeeMID.Value)); if (objResult.resultDT.Rows.Count > 0) { gvReport.DataSource = objResult.resultDT; gvReport.DataBind(); gvReport1.DataSource = objResult.resultDT; gvReport1.DataBind(); divReport.Visible = true; divtimeTable.Visible = false; btnPrintDetail.Visible = true; btnBack1.Visible = true; //btnPrintDetail.Visible = true; lblTrust.Text = Session[ApplicationSession.TRUSTNAME].ToString(); lblSchool.Text = Session[ApplicationSession.SCHOOLNAME].ToString(); lblName.Text = txtEmployeeName.Text; } else { divReport.Visible = false; divtimeTable.Visible = true; btnPrintDetail.Visible = false; btnBack1.Visible = false; ClearAll(); ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('No Records Found.');", true); } }
public void BindTimeTable() { ApplicationResult objResult = new ApplicationResult(); TimeTableBL objTimeTableBl = new TimeTableBL(); objResult = objTimeTableBl.TimeTable_Select_By_Class_Division(Convert.ToInt32(ddlClass.SelectedValue), Convert.ToInt32(ddlDivision.SelectedValue)); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { for (int i = 1; i <= 7; i++) { DataTable dtTemp = objResult.resultDT.AsEnumerable().Where(r => r.Field <int>("DayNo") == i) .CopyToDataTable(); if (dtTemp.Rows.Count > 0) { for (int j = 1; j <= Convert.ToInt32(hfNoOfPeriod.Value); j++) { Label lbl1 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblFrom" + j.ToString() + "" + i.ToString()) as Label; lbl1.Text = dtTemp.Rows[j - 1]["FromTime"].ToString(); Label lbl2 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblTo" + j.ToString() + "" + i.ToString()) as Label; lbl2.Text = dtTemp.Rows[j - 1]["ToTime"].ToString(); Label lbl3 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblSub" + j.ToString() + "" + i.ToString()) as Label; lbl3.Text = dtTemp.Rows[j - 1]["SubjectName"].ToString(); Label lbl4 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblTeacher" + j.ToString() + "" + i.ToString()) as Label; lbl4.Text = "(" + dtTemp.Rows[j - 1]["Teacher"].ToString() + ")"; } } } divTimeTable.Visible = true; } else { divTimeTable.Visible = false; } } ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>BindTimeTable(" + Convert.ToInt32(hfNoOfPeriod.Value) + ");</script>"); }
public void BindTimeTable() { ApplicationResult objResult = new ApplicationResult(); TimeTableBL objTimeTableBl = new TimeTableBL(); objResult = objTimeTableBl.TimeTable_Select_TeacherWise(Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), Convert.ToInt32((hfEmployeeMID.Value))); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { for (int i = 1; i <= objResult.resultDT.Rows.Count; i++) { int intCount = Convert.ToInt32(objResult.resultDT.Rows[i][5].ToString()); DataTable dtTemp = objResult.resultDT.AsEnumerable().Where(r => r.Field <int>("DayNo") == Convert.ToInt32(objResult.resultDT.Rows[i][5].ToString())) .CopyToDataTable(); if (dtTemp.Rows.Count > 0) { ViewState["MaxNo"] = objResult.resultDT.Rows[0][10].ToString(); for (int j = 1; j <= Convert.ToInt32(objResult.resultDT.Rows[i][9].ToString()); j++) { Label lbl1 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblFrom" + j.ToString() + "" + i.ToString()) as Label; lbl1.Text = dtTemp.Rows[j - 1]["FromTime"].ToString(); Label lbl2 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblTo" + j.ToString() + "" + i.ToString()) as Label; lbl2.Text = dtTemp.Rows[j - 1]["ToTime"].ToString(); Label lbl3 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblClass" + j.ToString() + "" + i.ToString()) as Label; lbl3.Text = dtTemp.Rows[j - 1]["ClassName"].ToString(); Label lbl4 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblDivision" + j.ToString() + "" + i.ToString()) as Label; lbl4.Text = dtTemp.Rows[j - 1]["DivisionName"].ToString(); Label lbl5 = Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblSUbject" + j.ToString() + "" + i.ToString()) as Label; lbl5.Text = dtTemp.Rows[j - 1]["SubjectName"].ToString(); } } } } } ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>BindTimeTable(" + Convert.ToInt32(ViewState["MaxNo"].ToString()) + ");</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>"); } }