Exemple #1
0
        //Bind Item Unit
        #region [Bind Item Unit]

        public DataSet BindUnit_DL(EWA_Item objEWA)
        {
            DataSet ds = new DataSet();

            try
            {
                prmList    = new string[4];
                prmList[0] = "@Action";
                prmList[1] = "FetchUnit";

                prmList[2] = "@OrgId";
                prmList[3] = Convert.ToString(objEWA.OrgId);

                ds = ObjHelper.FillControl(prmList, "SP_Item");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    return(ds);
                }
                else
                {
                }
                return(ds);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
        //Get Generated Item Code
        #region [Get Item Code]

        private string GetItemCode()
        {
            try
            {
                EWA_Item objEWA = new EWA_Item();
                BL_Item  objBL  = new BL_Item();

                float CategoryId = db.getDb_Value("SELECT CategoryId FROM  tblCategory where OrgId='" + orgId.ToString() + "' ");



                objEWA.CategoryId = CategoryId.ToString();
                DataSet dsData   = objBL.GetItemCode_BL(objEWA);
                string  ItemCode = string.Empty;
                if (dsData.Tables[0].Rows.Count > 0)
                {
                    ItemCode = dsData.Tables[0].Rows[0][0].ToString();
                }
                return(ItemCode);
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
                return("");
            }
        }
Exemple #3
0
        //To Check Duplicate Item
        #region [Check Duplicate Item]

        public int CheckDuplicateItem_DL(EWA_Item objEWA)
        {
            try
            {
                prmList    = new string[4];
                prmList[0] = "@Action";
                prmList[1] = "CheckData";

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

                DataSet dsData = ObjHelper.FillControl(prmList, "SP_Item");
                if (dsData.Tables[0].Rows.Count > 0)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemple #4
0
        //Action Performed
        #region [ActionPerformed For Item ]

        public int ItemAction_BL(EWA_Item objEWA)
        {
            try
            {
                DL_Item objDL = new DL_Item();
                int     flag  = objDL.ItemAction_DL(objEWA);
                return(flag);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemple #5
0
        //Check Duplicate  Item
        #region [Check Duplicate Item]

        public int CheckDuplicateItem_BL(EWA_Item objEWA)
        {
            try
            {
                DL_Item objDL = new DL_Item();
                int     i     = objDL.CheckDuplicateItem_DL(objEWA);
                return(i);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemple #6
0
        //Bind Item Unit
        #region [Bind Item Unit]

        public DataSet BindUnit_BL(EWA_Item objEWA)
        {
            try
            {
                DL_Item objDL = new DL_Item();
                DataSet ds    = objDL.BindUnit_DL(objEWA);
                return(ds);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemple #7
0
 public DataSet GetItemCode_BL(EWA_Item objEWA)
 {
     try
     {
         DL_Item objDL = new DL_Item();
         DataSet ds    = objDL.GetItemCode_DL(objEWA);
         return(ds);
     }
     catch (Exception exp)
     {
         throw exp;
     }
 }
        //Check Data
        #region [Check Data]

        private int CheckData()
        {
            int i = 0;

            try
            {
                EWA_Item objEWA = new EWA_Item();
                BL_Item  objBL  = new BL_Item();
                objEWA.ItemName = txtItemName.Text.Trim();
                i = objBL.CheckDuplicateItem_BL(objEWA);
                return(i);
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
                return(0);
            }
        }
Exemple #9
0
        //Perform Action on Item Table

        #region [Perform Actions On Item]

        public int ItemAction_DL(EWA_Item objEWA)
        {
            try
            {
                cmd             = new SqlCommand("SP_Item", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Action", objEWA.Action);
                cmd.Parameters.AddWithValue("@ItemId", objEWA.ItemId);
                cmd.Parameters.AddWithValue("@ItemName", objEWA.ItemName);
                cmd.Parameters.AddWithValue("@ItemCode", objEWA.ItemCode);
                cmd.Parameters.AddWithValue("@CategoryId", objEWA.CategoryId);
                cmd.Parameters.AddWithValue("@UnitId", objEWA.UnitId);
                cmd.Parameters.AddWithValue("@Stock", objEWA.Stock);
                cmd.Parameters.AddWithValue("@OrgId", objEWA.OrgId);
                cmd.Parameters.AddWithValue("@UserId", objEWA.UserId);
                cmd.Parameters.AddWithValue("@IsActive", objEWA.IsActive);
                con.Open();
                int flag = cmd.ExecuteNonQuery();
                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();
            }
        }
        private void BindUnit()
        {
            try
            {
                EWA_Item objEWA = new EWA_Item();
                BL_Item  objBL  = new BL_Item();
                //objEWA.OrgId = orgId;
                objEWA.OrgId = Convert.ToInt32(Session["OrgId"]);
                DataSet dsUnit = objBL.BindUnit_BL(objEWA);
                ddlUnit.DataSource     = dsUnit;
                ddlUnit.DataValueField = "UnitId";
                ddlUnit.DataTextField  = "UnitName";
                ddlUnit.DataBind();
                ddlUnit.Items.Insert(0, "Select");


                //if (ddlCategory.Items.Count <= 1)
                //{
                //    using (SqlCommand cmd = new SqlCommand("     SELECT        UnitName, UnitId FROM            tblUnit   where OrgId='" + orgId.ToString() + "' "))
                //    {
                //        cmd.CommandType = CommandType.Text;
                //        cmd.Connection = cn;
                //        cn.Open();
                //        ddlCategory.DataSource = cmd.ExecuteReader();
                //        ddlCategory.DataValueField = "UnitId";
                //        ddlCategory.DataTextField = "UnitName";
                //        ddlCategory.DataBind();
                //        cn.Close();
                //    }

                //    ddlCategory.Items.Insert(0, new ListItem("--Select Unit--"));
                //}
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Exemple #11
0
        //Get GetItemCode
        #region [Max ItemCode Id]
        public DataSet GetItemCode_DL(EWA_Item objEWA)
        {
            DataSet ds = new DataSet();

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

                ds = ObjHelper.FillControl(prmList, "SP_Item");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    return(ds);
                }
                return(ds);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }