//To CheckDuplicateDocument #region [Check Duplicate Document] public int CheckDuplicateAcademicYear_DL(EWA_AcademicYear objEWA) { try { prmList = new string[6]; prmList[0] = "@Action"; prmList[1] = "CheckData"; prmList[2] = "@AcademicYear"; prmList[3] = objEWA.AcademicYear; prmList[4] = "@OrgId"; prmList[5] = Convert.ToString(objEWA.OrgId); DataSet dsData = ObjHelper.FillControl(prmList, "SP_AcademicYear"); if (dsData.Tables[0].Rows.Count > 0) { return(1); } else { return(0); } } catch (Exception exp) { throw exp; } }
//To Bind DocumentGrid #region [Bind Document Grid] public DataSet BindAcademicYearGrid_DL(EWA_AcademicYear 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_AcademicYear"); if (ds.Tables[0].Rows.Count > 0) { return(ds); } else { DataTable dt = new DataTable(); dt.Columns.Add("AcademicYear"); dt.Columns.Add("StartDate"); dt.Columns.Add("EndDate"); dt.Rows.Add(); dt.Rows.Add(); dt.Rows.Add(); //return dsCode; } return(ds); } catch (Exception exp) { throw exp; } }
//Bind Current Year Region #region [Bind Current Year Region] public DataSet BindAcademicYear_BL(EWA_AcademicYear ObjEWA) { try { DL_Fees ObjDL = new DL_Fees(); DataSet ds = ObjDL.BindAcademicYear_DL(ObjEWA); return(ds); } catch (Exception) { throw; } }
//To check IsCurrentAcademic Year #region [Current Academic Year Region] public int CheckAcademicYear_BL(EWA_AcademicYear objEWA) { try { DL_AcademicYear objDL = new DL_AcademicYear(); int i = objDL.CheckAcademicYear_DL(objEWA); return(i); } catch (Exception) { throw; } }
//To Call AcademicYearGridBind #region [Academic Year Grid Bind] public DataSet AcademicYearGridBind_BL(EWA_AcademicYear objEWA) { try { DL_AcademicYear objDL = new DL_AcademicYear(); DataSet ds = objDL.BindAcademicYearGrid_DL(objEWA); return(ds); } catch (Exception) { throw; } finally { objDL = null; } }
//Insert Update Delete operaeion on AcademicYear Table #region [Action Performed] public int AcademicYearAction_BL(EWA_AcademicYear objEWA) { try { DL_AcademicYear objDL = new DL_AcademicYear(); int flag = objDL.AcademicYearAction_DL(objEWA); return(flag); } catch (Exception) { throw; } finally { objDL = null; } }
//Check Existing Data #region [Check Data] private int CheckData() { try { int i = 0; EWA_AcademicYear objEWA = new EWA_AcademicYear(); objEWA.OrgId = orgId; objEWA.AcademicYear = txtAcademicYear.Text.Trim(); i = objBL.CheckDuplicateAcademicYear_BL(objEWA); return(i); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); return(0); } }
//Bind Academic Year #region [Bind Academic Year] protected void BindAcademicYear() { try { EWA_AcademicYear ObjEWA = new EWA_AcademicYear(); BL_Fees ObjBL = new BL_Fees(); ObjEWA.OrgId = Convert.ToInt32(Session["OrgId"]); DataSet ds = ObjBL.BindAcademicYear_BL(ObjEWA); ddlAcademicYear.DataSource = ds; ddlAcademicYear.DataTextField = "AcademicYear"; ddlAcademicYear.DataValueField = "AcademicYearId"; ddlAcademicYear.DataBind(); ddlAcademicYear.Items.Insert(0, new ListItem("Select", "0")); BindEmptyDataTable(); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//To Perform Insert,Update,Delete and Search Actions On AcademicYear Table #region [Perform Actions On Academic Year] public int AcademicYearAction_DL(EWA_AcademicYear objEWA) { try { cmd = new SqlCommand("SP_AcademicYear", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", objEWA.Action); cmd.Parameters.AddWithValue("@AcademicYearId", objEWA.AcademicYearId); cmd.Parameters.AddWithValue("@AcademicYear", objEWA.AcademicYear); cmd.Parameters.AddWithValue("@StartDate", objEWA.StartDate); cmd.Parameters.AddWithValue("@EndDate", objEWA.EndDate); cmd.Parameters.AddWithValue("@Code", objEWA.Code); cmd.Parameters.AddWithValue("@IsCurrentYear", objEWA.IsCurrentYear); cmd.Parameters.AddWithValue("@OrgId", objEWA.OrgId); 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(); } }
//Save AcademicYear #region [Save Data] protected void btnSave_Click(object sender, EventArgs e) { BL_AcademicYear objBL = new BL_AcademicYear(); EWA_AcademicYear objEWA = new EWA_AcademicYear(); try { lock (this) { if (txtAcademicYear.Text == "") { msgBox.ShowMessage("Please Enter AcademicYear Name !!!", "Information", UserControls.MessageBox.MessageStyle.Information); } else { //ViewState["DocumentId"] = 0; int chk = CheckData(); if (chk > 0) { msgBox.ShowMessage("Record Allready Exist !!!", "Information", UserControls.MessageBox.MessageStyle.Information); } else { AcademicYearAction("Save"); GrdAcademicYearBind(); LoadForm(); } } } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); //throw; } }
//Bind Current Year #region [Bind Current Year] public DataSet BindAcademicYear_DL(EWA_AcademicYear ObjEWA) { DataSet ds = new DataSet(); try { prmList = new string[4]; prmList[0] = "@Action"; prmList[1] = "AcademicYear"; prmList[2] = "@OrgId"; prmList[3] = Convert.ToString(ObjEWA.OrgId); ds = ObjHelper.FillControl(prmList, "SP_AcademicYear"); if (ds.Tables[0].Rows.Count > 0) { return(ds); } return(ds); } catch (Exception exp) { throw exp; } }