Example #1
0
        public void SaveProductCounterMapping(string Counter)
        {
            StringBuilder strSql = new StringBuilder();
            int           i      = 0;

            strSql.Append("Delete from [ERP].[ProductCounterMapping] where CounterId ='" + Counter + "' \n");
            foreach (ProductCounterMappingList det in this.ModelProductCounterMappingList)
            {
                strSql.Append("INSERT INTO [ERP].[ProductCounterMapping](CounterId, ProductId) values ('" + Counter + "','" + det.ProductId + "') \n");
                i++;
            }
            ModelProductMappingList.Clear();
            DAL.ExecuteNonQuery(System.Data.CommandType.Text, strSql.ToString());
        }
Example #2
0
        //------------ START PRODUCT MAPPING --------
        public void SaveProductMapping(string Module)
        {
            StringBuilder strSql = new StringBuilder();
            int           i      = 0;

            foreach (ProductMappingList det in this.ModelProductMappingList)
            {
                if (Module == "ProductGroup")
                {
                    strSql.Append("UPDATE ERP.Product  set ProductGrpId='" + det.ProductGrpId + "' where ProductId='" + det.ProductId + "' \n");
                }
                else if (Module == "ProductSubGroup")
                {
                    strSql.Append("UPDATE ERP.Product  set ProductGrpId='" + det.ProductGrpId + "',ProductSubGrpId = '" + det.ProductSubGrpId + "' where ProductId='" + det.ProductId + "' \n");
                }

                else if (Module == "Branch")
                {
                    if (i == 0)
                    {
                        strSql.Append("Delete from [ERP].[ProductBranchUnitMapping] where BranchId ='" + det.BranchId + "' \n");
                    }
                    strSql.Append("INSERT INTO [ERP].[ProductBranchUnitMapping] (ProductId, BranchId, CompanyUnitId) \n");
                    strSql.Append("Select '" + det.ProductId + "','" + det.BranchId + "',null \n");
                }
                else if (Module == "CompanyUnit")
                {
                    if (i == 0)
                    {
                        strSql.Append("Delete from [ERP].[ProductBranchUnitMapping] where CompanyUnitId ='" + det.CompanyUnitId + "' \n");
                    }
                    strSql.Append("INSERT INTO [ERP].[ProductBranchUnitMapping] (ProductId, BranchId, CompanyUnitId) \n");
                    strSql.Append("Select '" + det.ProductId + "','" + det.BranchId + "','" + det.CompanyUnitId + "' \n");
                }
                i++;
            }
            ModelProductMappingList.Clear();
            DAL.ExecuteNonQuery(System.Data.CommandType.Text, strSql.ToString());
        }