コード例 #1
0
        //To CheckDuplicateCountry
        #region [Check Duplicate Country]
        public int CheckDuplicateCountry_DL(EWA_CountryStateDistrict objEWA)
        {
            try
            {
                prmList    = new string[4];
                prmList[0] = "@Action";
                prmList[1] = objEWA.Action;

                prmList[2] = "@CountryName";
                prmList[3] = objEWA.CountryName;


                DataSet dsData = ObjHelper.FillControl(prmList, "SP_CountryStateDistrict");
                if (dsData.Tables[0].Rows.Count > 0)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
コード例 #2
0
        //Insert Update Delete operation on State Table
        #region [Action Performed]

        public int StateAction_BL(EWA_CountryStateDistrict objEWA)
        {
            DL_CountryStateDistrict objDL = new DL_CountryStateDistrict();

            try
            {
                int flag = objDL.StateAction_DL(objEWA);
                return(flag);
            }
            catch (Exception ex)
            {
                int err = ((System.Data.SqlClient.SqlException)(ex)).Number;
                if (err == 547 && objEWA.Action == "DeleteState")
                {
                    throw new SystemException("Record is in use !!!");
                }
                else
                {
                    throw ex;
                }
            }
            finally
            {
                // con.Close();
                // cmd.Dispose();
                objDL = null;
            }
        }
コード例 #3
0
        //To Perform Insert,Update,Delete and Search Actions On Country Table
        #region [Perform Actions On Country]
        public int CountryAction_DL(EWA_CountryStateDistrict objEWA)
        {
            try
            {
                cmd             = new SqlCommand("SP_CountryStateDistrict", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Action", objEWA.Action);
                cmd.Parameters.AddWithValue("@CountryId", objEWA.CountryId);
                cmd.Parameters.AddWithValue("@CountryName", objEWA.CountryName);

                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();
            }
        }
コード例 #4
0
        //State Grid Bind
        #region [State Grid Bind]

        private void GrdStateBind()
        {
            try
            {
                objEWA           = new EWA_CountryStateDistrict();
                objEWA.Action    = "SelectDataState";
                objEWA.CountryId = ddlCountryS.SelectedValue.ToString();
                if (ddlCountryS.SelectedValue.ToString() != "Select")
                {
                    DataSet ds = objBL.StateGridBind_BL(objEWA);
                    if (ds.Tables[0].Rows.Count == 0 || ds == null)
                    {
                        ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
                        GrdState.DataSource = ds;
                        GrdState.DataBind();
                        int columncount = GrdState.Rows[0].Cells.Count;
                        GrdState.Rows[0].Cells.Clear();
                        GrdState.Rows[0].Cells.Add(new TableCell());
                        GrdState.Rows[0].Cells[0].ColumnSpan = columncount;
                        GrdState.Rows[0].Cells[0].Text       = "No Records Found";
                    }
                    else
                    {
                        GrdState.DataSource = ds;
                        GrdState.DataBind();
                    }
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
コード例 #5
0
        //To Bind CountryGrid
        #region [Bind Country Grid]
        public DataSet BindCountryGrid_DL(EWA_CountryStateDistrict objEWA)
        {
            DataSet ds = new DataSet();

            try
            {
                prmList    = new string[2];
                prmList[0] = "@Action";
                prmList[1] = objEWA.Action;


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

                    //dt.Rows.Add();
                    //dt.Rows.Add();
                    //dt.Rows.Add();
                    //return dsCode;
                }
                return(ds);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
コード例 #6
0
        //Country Grid Bind
        #region [Country Grid Bind]

        private void GrdCountryBind()
        {
            try
            {
                objEWA = new EWA_CountryStateDistrict();
                //Pass it from Session
                objEWA.Action = "SelectDataCountry";
                DataSet ds = objBL.CountryGridBind_BL(objEWA);
                if (ds.Tables[0].Rows.Count == 0 || ds == null)
                {
                    ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
                    GrdCountry.DataSource = ds;
                    GrdCountry.DataBind();
                    int columncount = GrdCountry.Rows[0].Cells.Count;
                    GrdCountry.Rows[0].Cells.Clear();
                    GrdCountry.Rows[0].Cells.Add(new TableCell());
                    GrdCountry.Rows[0].Cells[0].ColumnSpan = columncount;
                    GrdCountry.Rows[0].Cells[0].Text       = "No Records Found";
                }
                else
                {
                    GrdCountry.DataSource = ds;
                    GrdCountry.DataBind();
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
コード例 #7
0
        //To Check Duplicate Data
        #region [Check Duplicate Course]

        public int CheckDuplicateCountry_BL(EWA_CountryStateDistrict objEWA)
        {
            try
            {
                DL_CountryStateDistrict objDL = new DL_CountryStateDistrict();
                int i = objDL.CheckDuplicateCountry_DL(objEWA);
                return(i);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #8
0
        //To Call District Grid Bind
        #region [District Grid Bind]

        public DataSet DistrictGridBind_BL(EWA_CountryStateDistrict objEWA)
        {
            try
            {
                DL_CountryStateDistrict objDL = new DL_CountryStateDistrict();
                DataSet ds = objDL.BindDistrictGrid_DL(objEWA);
                return(ds);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #9
0
        //Page Indext Created
        #region GrdIndexChanged

        protected void GrdCountry_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            try
            {
                GrdCountry.PageIndex = e.NewPageIndex;
                objEWA                = new EWA_CountryStateDistrict();
                objEWA.Action         = "SelectDataCountry";
                GrdCountry.DataSource = objBL.CountryGridBind_BL(objEWA);
                GrdCountry.DataBind();
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
コード例 #10
0
        //Check Existing Data
        #region [Check Data]

        private int CheckData()
        {
            try
            {
                objEWA             = new EWA_CountryStateDistrict();
                objEWA.CountryName = txtCountryName.Text.Trim();
                objEWA.Action      = "CheckDataCountry";
                int i = objBL.CheckDuplicateCountry_BL(objEWA);
                return(i);
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
                return(0);
            }
        }
コード例 #11
0
        //Insert Update Delete operaeion on Country Table
        #region [Action Performed]

        public int CountryAction_BL(EWA_CountryStateDistrict objEWA)
        {
            DL_CountryStateDistrict objDL = new DL_CountryStateDistrict();

            try
            {
                int flag = objDL.CountryAction_DL(objEWA);
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objDL = null;
            }
        }
コード例 #12
0
        //Country Bind
        #region [Country Bind]

        private void ddlCountryBind()
        {
            try
            {
                objEWA        = new EWA_CountryStateDistrict();
                objEWA.Action = "SelectDataCountry";
                DataSet ds = objBL.CountryGridBind_BL(objEWA);
                ddlCountry.DataSource     = ds;
                ddlCountry.DataTextField  = "CountryName";
                ddlCountry.DataValueField = "CountryId";
                ddlCountry.DataBind();
                ddlCountry.Items.Insert(0, "Select");
                ddlCountry.SelectedIndex = 0;
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
コード例 #13
0
        //State grid
        #region [State Grid]

        private void ddlStateDBind()
        {
            try
            {
                objEWA           = new EWA_CountryStateDistrict();
                objEWA.Action    = "SelectDataState";
                objEWA.CountryId = ddlCountry.SelectedValue.ToString();
                DataSet ds = objBL.StateGridBind_BL(objEWA);
                ddlStateD.DataSource     = ds;
                ddlStateD.DataTextField  = "StateName";
                ddlStateD.DataValueField = "StateId";
                ddlStateD.DataBind();
                ddlStateD.Items.Insert(0, "Select");
                ddlStateD.SelectedIndex = 0;
                GrdDistrict.DataSource  = null;
                GrdDistrict.DataBind();
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }