public DataSet CheckEmployeeExists(EWA_TimeTableCreation objEWA2) { DataSet ds = new DataSet(); try { prmList = new string[10]; prmList[0] = "@Action"; prmList[1] = "CheckEmployeeExists"; prmList[2] = "@ClassId"; prmList[3] = objEWA2.ClassId.ToString(); prmList[4] = "@DayId"; prmList[5] = objEWA2.DayId.ToString(); prmList[6] = "@SubEmpId"; prmList[7] = objEWA2.SubEmpId.ToString(); prmList[8] = "@LectureNo"; prmList[9] = objEWA2.LecNo.ToString(); ds = ObjHelper.FillControl(prmList, "SP_TimeTableCreationAction"); return(ds); } catch (Exception ex) { throw ex; } finally { con.Close(); } }
private void BindEmpSub() { try { BL_TimeTableCreation objBl = new BL_TimeTableCreation(); EWA_TimeTableCreation objEwa = new EWA_TimeTableCreation(); ddlEmployee.Items.Clear(); if (ddlSubject.SelectedValue == "501") { ddlEmployee.Items.Insert(0, new ListItem("NA", "501")); } else { objEwa.SubjectId = Convert.ToInt32(ddlSubject.SelectedValue.ToString()); DataSet ds = objBl.GetEmpSub(objEwa); ddlEmployee.DataSource = ds; ddlEmployee.DataTextField = "EmpName"; ddlEmployee.DataValueField = "EmpId"; ddlEmployee.DataBind(); } ddlEmployee.Items.Insert(0, new ListItem("Select", "0")); ddlEmployee.SelectedIndex = 0; } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
public int TimeTableCreationAction_BL(EWA_TimeTableCreation objEWA) { try { int flag = objDL.TimeTableCreationAction_DL(objEWA); return(flag); } catch (Exception ex) { throw ex; } finally { objDL = null; } }
public DataSet GetEmpSub(EWA_TimeTableCreation objEWA) { try { DataSet ds = new DataSet(); ds = objDL.GetEmpSub(objEWA); return(ds); } catch (Exception ex) { throw ex; } finally { objDL = null; } }
public DataSet Employeetest(EWA_TimeTableCreation objEWA2) { try { DataSet ds = new DataSet(); ds = objDL.CheckEmployeeExists(objEWA2); return(ds); } catch (Exception ex) { throw ex; } finally { objDL = null; } }
private void BindTimeTable() { try { BL_TimeTableCreation objBl = new BL_TimeTableCreation(); EWA_TimeTableCreation objEwa = new EWA_TimeTableCreation(); objEwa.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); DataSet ds = objBl.GetTimeTable(objEwa); GrdTimeTable.DataSource = ds; GrdTimeTable.DataBind(); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
public int TimeTableCreationAction_DL(EWA_TimeTableCreation objEWA) { try { cmd = new SqlCommand("SP_TimeTableCreationAction", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", objEWA.Action); cmd.Parameters.AddWithValue("@TimeTableId", objEWA.TimeTableId); cmd.Parameters.AddWithValue("@CourseId", objEWA.CourseId); cmd.Parameters.AddWithValue("@BranchId", objEWA.BranchId); cmd.Parameters.AddWithValue("@ClassId", objEWA.ClassId); cmd.Parameters.AddWithValue("@SubjectId", objEWA.SubjectId); cmd.Parameters.AddWithValue("@SubEmpId", objEWA.SubEmpId); cmd.Parameters.AddWithValue("@DayId", objEWA.DayId); cmd.Parameters.AddWithValue("@TimeSlotId", objEWA.TimeSlotId); cmd.Parameters.AddWithValue("@OrgId", objEWA.OrgId); cmd.Parameters.AddWithValue("@LectureNo", objEWA.LecNo); cmd.Parameters.AddWithValue("@IsActive", objEWA.IsActive); con.Open(); int flag = cmd.ExecuteNonQuery(); con.Close(); return(flag); } catch (Exception ex) { int err = ((System.Data.SqlClient.SqlException)(ex)).Number; if (err == 547 && objEWA.Action == "Delete") { throw new SystemException("Record is in use !!!"); } else { throw ex; } } finally { con.Close(); cmd.Dispose(); } }
public DataSet GetTimeTable(EWA_TimeTableCreation objEWA) { DataSet ds = new DataSet(); try { prmList = new string[4]; prmList[0] = "@Action"; prmList[1] = "GetTimeTable"; prmList[2] = "@ClassId"; prmList[3] = objEWA.ClassId.ToString(); ds = ObjHelper.FillControl(prmList, "SP_TimeTableCreationAction"); return(ds); } catch (Exception ex) { throw ex; } finally { con.Close(); } }
public void overlapEmployee(string strAction) { try { //To check Date According to Current Date DateTime CurrentDate = DateTime.Now.Date; int CurrentStartYear = CurrentDate.Year; DateTime CurrentEndYear = CurrentDate.AddYears(1); int CurrentMonth = CurrentDate.Month; BL_TimeTableCreation objBl = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA = new EWA_TimeTableCreation(); objEWA.Action = strAction; objEWA.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA.LecNo = Convert.ToInt32(txtlectureno.Text); if (strAction == "Update" || strAction == "Delete") { objEWA.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString()); } else { objEWA.TimeTableId = 0; } objEWA.CourseId = Convert.ToInt32(ddlCourse.SelectedValue.ToString()); objEWA.BranchId = Convert.ToInt32(ddlBranch.SelectedValue.ToString()); objEWA.SubjectId = Convert.ToInt32(ddlSubject.SelectedValue.ToString()); objEWA.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA.OrgId = orgId; objEWA.UserId = Session["UserCode"].ToString(); objEWA.LecNo = Convert.ToInt32(txtlectureno.Text); objEWA.IsActive = "True"; //int flag = objBL.(objEWA); int flag = objBl.TimeTableCreationAction_BL(objEWA); if (flag > 0) { ClearCntrl(); DisableCntrl(); BindTimeTable(); if (strAction == "Save") { msgBox.ShowMessage("Overlap Record Saved Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull); } else if (strAction == "Update") { msgBox.ShowMessage("Overlap Record Updated Successfully !!!", "Updated", UserControls.MessageBox.MessageStyle.Successfull); } else if (strAction == "Delete") { msgBox.ShowMessage("Overlap Record Deleted Successfully !!!", "Deleted", UserControls.MessageBox.MessageStyle.Successfull); } } else { if (strAction == "Save") { msgBox.ShowMessage("Unable to Save !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } else if (strAction == "Update") { msgBox.ShowMessage("Unable to Update !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } else if (strAction == "Delete") { msgBox.ShowMessage("Unable to Delete !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } } } catch (Exception ex) { } }
public void overlapsubject(string strAction) { try { BL_TimeTableCreation objBl1 = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA1 = new EWA_TimeTableCreation(); objEWA1.Action = strAction; objEWA1.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA1.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA1.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA1.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA1.LecNo = Convert.ToInt32(txtlectureno.Text); if (strAction == "Update" || strAction == "Delete") { objEWA1.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString()); } else { objEWA1.TimeTableId = 0; } DataSet ds1 = objBl1.CheckTimeTable1(objEWA1); if ((ds1.Tables[0].Rows.Count <= 0 && strAction == "Save") || (strAction == "Update" && ds1.Tables[0].Rows.Count <= 0) || (strAction == "Update" && ds1.Tables[0].Rows[0][0].ToString() == objEWA1.TimeTableId.ToString()) || strAction == "Delete") { //To check Date According to Current Date DateTime CurrentDate = DateTime.Now.Date; int CurrentStartYear = CurrentDate.Year; DateTime CurrentEndYear = CurrentDate.AddYears(1); int CurrentMonth = CurrentDate.Month; BL_TimeTableCreation objBl = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA = new EWA_TimeTableCreation(); objEWA.Action = strAction; objEWA.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA.LecNo = Convert.ToInt32(txtlectureno.Text); if (strAction == "Update" || strAction == "Delete") { objEWA.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString()); } else { objEWA.TimeTableId = 0; } objEWA.CourseId = Convert.ToInt32(ddlCourse.SelectedValue.ToString()); objEWA.BranchId = Convert.ToInt32(ddlBranch.SelectedValue.ToString()); objEWA.SubjectId = Convert.ToInt32(ddlSubject.SelectedValue.ToString()); objEWA.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA.LecNo = Convert.ToInt32(txtlectureno.Text); objEWA.OrgId = orgId; objEWA.UserId = Session["UserCode"].ToString(); objEWA.IsActive = "True"; //int flag = objBL.(objEWA); int flag = objBl.TimeTableCreationAction_BL(objEWA); if (flag > 0) { ClearCntrl(); DisableCntrl(); BindTimeTable(); if (strAction == "Save") { msgBox.ShowMessage("Overlap Record Saved Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull); } else if (strAction == "Update") { msgBox.ShowMessage("Overlap Record Updated Successfully !!!", "Updated", UserControls.MessageBox.MessageStyle.Successfull); } else if (strAction == "Delete") { msgBox.ShowMessage("Overlap Record Deleted Successfully !!!", "Deleted", UserControls.MessageBox.MessageStyle.Successfull); } } else { if (strAction == "Save") { msgBox.ShowMessage("Unable to Save !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } else if (strAction == "Update") { msgBox.ShowMessage("Unable to Update !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } else if (strAction == "Delete") { msgBox.ShowMessage("Unable to Delete !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } } } else { MessagePopUp1.Show(); //msgBox.ShowMessage("Already Created !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); //DialogResult res = MessageBox.Show("Employee Overlap! Are You OK with Employee Overlap?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); //if (res == DialogResult.Yes) //{ // overlapEmployee(strAction); //} //if (res == DialogResult.No) //{ //} } } catch (Exception ex) { } }
//General message #region [General Message] private void Action(string strAction) { try { BL_TimeTableCreation objBl1 = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA1 = new EWA_TimeTableCreation(); objEWA1.Action = strAction; Session["strAction"] = strAction; objEWA1.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA1.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA1.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA1.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA1.LecNo = Convert.ToInt32(txtlectureno.Text); if (strAction == "Update" || strAction == "Delete") { objEWA1.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString()); } else { objEWA1.TimeTableId = 0; } DataSet ds = objBl1.CheckTimeTable(objEWA1); if ((ds.Tables[0].Rows.Count <= 0 && strAction == "Save") || (strAction == "Update" && ds.Tables[0].Rows.Count <= 0) || (strAction == "Update" && ds.Tables[0].Rows[0][0].ToString() == objEWA1.TimeTableId.ToString()) || strAction == "Delete") { BL_TimeTableCreation objBl2 = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA2 = new EWA_TimeTableCreation(); BL_TimeTableCreation objBl22 = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA22 = new EWA_TimeTableCreation(); objEWA22.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA22.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA22.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA22.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA2.LecNo = Convert.ToInt32(txtlectureno.Text); DataSet dss = objBl22.Employeetest(objEWA22); if (dss.Tables[0].Rows.Count > 0) { msgBox.ShowMessage("Already lecture assigned to teacher for that day", "Saved", UserControls.MessageBox.MessageStyle.Critical); } objEWA2.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA2.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA2.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA2.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA2.LecNo = Convert.ToInt32(txtlectureno.Text); if (strAction == "Update" || strAction == "Delete") { objEWA2.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString()); } else { objEWA2.TimeTableId = 0; } DataSet ds1 = objBl2.CheckTimeTable1(objEWA2); if ((ds1.Tables[0].Rows.Count <= 0 && strAction == "Save") || (strAction == "Update" && ds1.Tables[0].Rows.Count <= 0) || (strAction == "Update" && ds1.Tables[0].Rows[0][0].ToString() == objEWA1.TimeTableId.ToString()) || strAction == "Delete") { //To check Date According to Current Date DateTime CurrentDate = DateTime.Now.Date; int CurrentStartYear = CurrentDate.Year; DateTime CurrentEndYear = CurrentDate.AddYears(1); int CurrentMonth = CurrentDate.Month; BL_TimeTableCreation objBl = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA = new EWA_TimeTableCreation(); objEWA.Action = strAction; objEWA.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA.LecNo = Convert.ToInt32(txtlectureno.Text); if (strAction == "Update" || strAction == "Delete") { objEWA.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString()); } else { objEWA.TimeTableId = 0; } objEWA.CourseId = Convert.ToInt32(ddlCourse.SelectedValue.ToString()); objEWA.BranchId = Convert.ToInt32(ddlBranch.SelectedValue.ToString()); objEWA.SubjectId = Convert.ToInt32(ddlSubject.SelectedValue.ToString()); objEWA.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA.OrgId = orgId; objEWA.UserId = Session["UserCode"].ToString(); objEWA.IsActive = "True"; objEWA.LecNo = Convert.ToInt32(txtlectureno.Text); //int flag = objBL.(objEWA); int flag = objBl.TimeTableCreationAction_BL(objEWA); if (flag > 0 && flag != 2) { ClearCntrl(); DisableCntrl(); BindTimeTable(); if (strAction == "Save") { msgBox.ShowMessage("Record Saved Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull); } else if (strAction == "Update") { msgBox.ShowMessage("Record Updated Successfully !!!", "Updated", UserControls.MessageBox.MessageStyle.Successfull); } else if (strAction == "Delete") { msgBox.ShowMessage("Record Deleted Successfully !!!", "Deleted", UserControls.MessageBox.MessageStyle.Successfull); } } else if (flag > 0 && flag == 2) { if (strAction == "Save") { msgBox.ShowMessage("Sorry For that day Lecture NO Already Used!!!", "Saved", UserControls.MessageBox.MessageStyle.Critical); } else if (strAction == "Update") { msgBox.ShowMessage("Sorry For that day Lecture NO Already Used !!!", "Updated", UserControls.MessageBox.MessageStyle.Critical); } } else { if (strAction == "Save") { msgBox.ShowMessage("Unable to Save !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } else if (strAction == "Update") { msgBox.ShowMessage("Unable to Update !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } else if (strAction == "Delete") { msgBox.ShowMessage("Unable to Delete !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } } } else { MessagePopUp1.Show(); //msgBox.ShowMessage("Already Created !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); //DialogResult res = MessageBox.Show("Employee Overlap! Are You OK with Employee Overlap?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); //if (res == DialogResult.Yes) //{ // overlapEmployee(strAction); //} //if (res == DialogResult.No) //{ //} } } else { //string message = "Your request is being processed."; //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //sb.Append("alert('"); //sb.Append(message); //sb.Append("');"); //ClientScript.RegisterOnSubmitStatement(this.GetType(), "alert", sb.ToString()); MessagePopUp.Show(); //DialogResult res = MessageBox.Show("Subject Overlap! Are You OK with Subject Overlap?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); //if (res == DialogResult.Yes) //{ // //MessageBox.Show("You have clicked Ok Button"); // overlapsubject(strAction); //} //if (res == DialogResult.No) //{ // //MessageBox.Show("You have clicked Cancel Button"); //} } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }