//Insert Update Delete operation on Branch Table #region [Action Performed] public int BranchAction_BL(EWA_ProgramExecutive objEWA) { DL_ProgramExecutive objDL = new DL_ProgramExecutive(); try { int flag = objDL.BranchAction_DL(objEWA); 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(); objDL = null; } }
//To CheckDuplicateCourse #region [Check Duplicate Course] public int CheckDuplicateCourse_DL(EWA_ProgramExecutive objEWA) { try { prmList = new string[6]; prmList[0] = "@Action"; prmList[1] = "CheckData"; prmList[2] = "@CourseName"; prmList[3] = objEWA.CourseName; prmList[4] = "@OrgId"; prmList[5] = Convert.ToString(objEWA.OrgId); DataSet dsData = ObjHelper.FillControl(prmList, "SP_Course"); if (dsData.Tables[0].Rows.Count > 0) { return(1); } else { return(0); } } catch (Exception exp) { throw exp; } }
//To Check Duplicate Data #region [Check Duplicate Course] public int CheckDuplicateCourse_BL(EWA_ProgramExecutive objEWA) { try { DL_ProgramExecutive objDL = new DL_ProgramExecutive(); int i = objDL.CheckDuplicateCourse_DL(objEWA); return(i); } catch (Exception) { throw; } }
//To Call Course Grid Bind #region [Course Grid Bind] public DataSet CourseGridBind_BL(EWA_ProgramExecutive objEWA) { try { DL_ProgramExecutive objDL = new DL_ProgramExecutive(); DataSet ds = objDL.BindCourseGrid_DL(objEWA); return(ds); } catch (Exception) { throw; } }
//Bind Classes #region [Bind Classes Region] public DataSet BindddlClasses_BL(EWA_ProgramExecutive objEWA) { try { DL_ProgramExecutive objDL = new DL_ProgramExecutive(); DataSet ds = objDL.BindddlClasses_DL(objEWA); return(ds); } catch (Exception) { throw; } }
//Insert Update Delete operaeion on Division Table #region [Action Performed] public int DivisionAction_BL(EWA_ProgramExecutive objEWA) { DL_ProgramExecutive objDL = new DL_ProgramExecutive(); try { int flag = objDL.DivisionAction_DL(objEWA); return(flag); } catch (Exception) { throw; } finally { objDL = null; } }
//Save Country #region SaveData protected void btnSave_Click(object sender, EventArgs e) { BL_ProgramExecutive objBL = new BL_ProgramExecutive(); EWA_ProgramExecutive objEWA = new EWA_ProgramExecutive(); try { lock (this) { if (txtCountryId.Text == "") { msgBox.ShowMessage("Country Id Not Found !!!", "Information", UserControls.MessageBox.MessageStyle.Information); } else if (txtCountryName.Text == "") { msgBox.ShowMessage("Please Enter Course Name !!!", "Information", UserControls.MessageBox.MessageStyle.Information); } else { //ViewState["CountryId"] = 0; int chk = CheckData(); if (chk > 0) { msgBox.ShowMessage("Record Allready Exist !!!", "Information", UserControls.MessageBox.MessageStyle.Information); } else { Action("SaveCountry"); GrdCountryBind(); LoadCountryTab(); Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true); } } } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//To Perform Insert,Update,Delete and Search Actions On Division Table #region [Perform Actions On Division] public int DivisionAction_DL(EWA_ProgramExecutive objEWA) { try { cmd = new SqlCommand("SP_Division", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", objEWA.ActionD); cmd.Parameters.AddWithValue("@DivisionId", objEWA.DivisionId); cmd.Parameters.AddWithValue("@DivisionName", objEWA.DivisionName); cmd.Parameters.AddWithValue("@DivisionCode", objEWA.DivisionCode); cmd.Parameters.AddWithValue("@ClassId", objEWA.ClassId); cmd.Parameters.AddWithValue("@UserId", objEWA.UserId); 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(); } }
//BindCourseDropDown #region [Bind Course Drop Down Region] public DataSet BindddlCourse_DL(EWA_ProgramExecutive objEWA) { DataSet ds = new DataSet(); try { prmList = new string[4]; prmList[0] = "@Action"; prmList[1] = "FetchCourse"; prmList[2] = "@OrgId"; prmList[3] = Convert.ToString(objEWA.OrgId); ds = ObjHelper.FillControl(prmList, "SP_Class"); return(ds); } catch (Exception exp) { throw exp; } }
//BindClassesDropDown #region [Bind Classes Drop Down Region] public DataSet BindddlClasses_DL(EWA_ProgramExecutive objEWA) { DataSet ds = new DataSet(); try { prmList = new string[4]; prmList[0] = "@Action"; prmList[1] = "FetchClasses"; prmList[2] = "@BranchId"; prmList[3] = objEWA.BranchId; ds = ObjHelper.FillControl(prmList, "SP_Class"); //if (ds.Tables[0].Rows.Count > 0) return(ds); } catch (Exception exp) { throw exp; } }
//To Bind CourseGrid #region [Bind Course Grid] public DataSet BindCourseGrid_DL(EWA_ProgramExecutive objEWA) { DataSet ds = new DataSet(); try { prmList = new string[4]; prmList[0] = "@Action"; prmList[1] = "SelectData"; prmList[2] = "@OrgId"; prmList[3] = Convert.ToString(objEWA.OrgId); ds = ObjHelper.FillControl(prmList, "SP_Course"); if (ds.Tables[0].Rows.Count > 0) { return(ds); } else { DataTable dt = new DataTable(); dt.Columns.Add("CourseId"); dt.Columns.Add("CourseCode"); dt.Columns.Add("CourseName"); //dt.Rows.Add(); //dt.Rows.Add(); //dt.Rows.Add(); //return dsCode; } return(ds); } catch (Exception exp) { throw exp; } }
//To Bind DivisionGrid #region [Bind Division Grid] public DataSet BindDivisionGrid_DL(EWA_ProgramExecutive objEWA) { DataSet ds = new DataSet(); try { prmList = new string[4]; prmList[0] = "@Action"; prmList[1] = "SelectData"; prmList[2] = "@ClassId"; prmList[3] = objEWA.ClassId; ds = ObjHelper.FillControl(prmList, "SP_Division"); if (ds.Tables[0].Rows.Count > 0) { return(ds); } else { DataTable dt = new DataTable(); dt.Columns.Add("DivisionId"); dt.Columns.Add("DivisionCode"); dt.Columns.Add("DivisionName"); dt.Rows.Add(); dt.Rows.Add(); dt.Rows.Add(); //return dsCode; } } catch (Exception exp) { throw exp; } return(ds); }