//To Check Duplicate Document
        #region [Check Duplicate Caste Category]

        public int CheckDuplicateCasteCategory_DL(EWA_CasteCategory objEWA)
        {
            try
            {
                prmList    = new string[6];
                prmList[0] = "@Action";
                prmList[1] = "CheckData";

                prmList[2] = "@CasteCategoryName";
                prmList[3] = objEWA.CasteCategoryName;
                prmList[4] = "@OrgId";
                prmList[5] = objEWA.OrgId.ToString();

                DataSet dsData = ObjHelper.FillControl(prmList, "SP_CasteCategory");
                if (dsData.Tables[0].Rows.Count > 0)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
        //Check Duplicate  caste category
        #region [Check Duplicate Caste Category]

        public int CheckDuplicateCasteCategory_BL(EWA_CasteCategory objEWA)
        {
            try
            {
                DL_CasteCategory objDL = new DL_CasteCategory();
                int i = objDL.CheckDuplicateCasteCategory_DL(objEWA);
                return(i);
            }
            catch (Exception exp)
            {
                throw exp;
            }
            finally
            {
                objDL = null;
            }
        }
        //Caste Category Grid Bind
        #region [Caste Category Grid Bind]

        public DataSet CasteCategoryGridBind_BL(EWA_CasteCategory objEWA)
        {
            try
            {
                DL_CasteCategory objDL = new DL_CasteCategory();
                DataSet          ds    = objDL.BindCasteCategoryGrid_DL(objEWA);
                return(ds);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objDL = null;
            }
        }
        //Action Performed
        #region [ActionPerformed For CasteCategory]

        public int CasteCategoryAction_BL(EWA_CasteCategory objEWA)
        {
            //  DL_Documents objDL = new DL_Documents();
            try
            {
                DL_CasteCategory objDL = new DL_CasteCategory();
                int flag = objDL.CasteCategoryAction_DL(objEWA);
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objDL = null;
            }
        }
Beispiel #5
0
        //Check Data
        #region [Check Data]

        private int CheckData()
        {
            int i = 0;

            try
            {
                EWA_CasteCategory objEWA = new EWA_CasteCategory();

                objEWA.OrgId             = Convert.ToInt32(orgId.ToString());
                objEWA.CasteCategoryName = txtCasteCategoryName.Text.Trim();
                i = objBL.CheckDuplicateCasteCategory_BL(objEWA);
                return(i);
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
                return(0);
            }
        }
Beispiel #6
0
        //Save Data
        #region SaveData

        protected void btnSave_Click(object sender, EventArgs e)
        {
            BL_CasteCategory  objBL  = new BL_CasteCategory();
            EWA_CasteCategory objEWA = new EWA_CasteCategory();

            try
            {
                lock (this)
                {
                    if (ddlOrganization.SelectedItem.Text == "Select")
                    {
                        msgBox.ShowMessage("Select Organization !!!", "Information", UserControls.MessageBox.MessageStyle.Information);
                    }
                    else if (txtCasteCategoryName.Text == "")
                    {
                        msgBox.ShowMessage("Please Enter Caste Category 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
                        {
                            Action("Save");
                            GrdCasteCategoryBind();
                            LoadForm();
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
        //Perform Action

        #region [Perform Actions On Caste Category]

        public int CasteCategoryAction_DL(EWA_CasteCategory objEWA)
        {
            try
            {
                cmd             = new SqlCommand("SP_CasteCategory", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Action", objEWA.Action);
                cmd.Parameters.AddWithValue("@CasteCategoryId", objEWA.CasteCategoryId);
                cmd.Parameters.AddWithValue("@CasteCategoryName", objEWA.CasteCategoryName);
                cmd.Parameters.AddWithValue("@Code", objEWA.Code);
                cmd.Parameters.AddWithValue("@OrgId", objEWA.OrgId);
                cmd.Parameters.AddWithValue("@AcademicYearId", 0);
                cmd.Parameters.AddWithValue("@UserId", objEWA.UserId);
                cmd.Parameters.AddWithValue("@TransDate", objEWA.TransDate);
                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();
            }
        }
        //Bind Caste Category
        #region [Bind Caste Category Grid]

        public DataSet BindCasteCategoryGrid_DL(EWA_CasteCategory objEWA)
        {
            DataSet ds = new DataSet();

            try
            {
                prmList    = new string[4];
                prmList[0] = "@Action";
                prmList[1] = "SelectData";
                prmList[2] = "OrgId";
                prmList[3] = objEWA.OrgId.ToString();

                ds = ObjHelper.FillControl(prmList, "SP_CasteCategory");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    return(ds);
                }
                else
                {
                    DataTable dt = new DataTable();
                    dt.Columns.Add("CasteCategoryName");
                    dt.Columns.Add("CasteCategorytCode");

                    // dt.Columns.Add("DocumentType");

                    dt.Rows.Add();
                    dt.Rows.Add();
                    dt.Rows.Add();
                    //return dsCode;
                }
                return(ds);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }