Example #1
0
 protected override void AddInsertUpdateParams(SqlCommand cmd, PurLine entity)
 {
     SqlHelper.AddParamInputId(cmd, "@PurOrderId", entity.PurOrderId.Value);
     SqlHelper.AddParamInputId(cmd, "@VendorProductId", entity.VendorProductId.Value);
     SqlHelper.AddParamMoney(cmd, "@CaseCostOverride", entity.CaseCostOverride);
     SqlHelper.AddParamMoney(cmd, "@EachCostOverride", entity.EachCostOverride);
     SqlHelper.AddParamTinyint(cmd, "@OrderedEaches", entity.OrderedEaches);
     SqlHelper.AddParamInt(cmd, "@QtyOrdered", entity.QtyOrdered);
     SqlHelper.AddParamInt(cmd, "@QtyReceived", entity.QtyReceived);
     SqlHelper.AddParamInt(cmd, "@QtyBackordered", entity.QtyBackordered);
     SqlHelper.AddParamInt(cmd, "@QtyDamaged", entity.QtyDamaged);
     SqlHelper.AddParamInt(cmd, "@QtyMissing", entity.QtyMissing);
     SqlHelper.AddParamInt(cmd, "@QtyOnHand", entity.QtyOnHand);
     SqlHelper.AddParamTinyint(cmd, "@SpecialOrder", entity.SpecialOrder);
     SqlHelper.AddParamVarchar(cmd, "@Notes", entity.Notes ?? string.Empty);
     SqlHelper.AddParamVarchar(cmd, "@ProductName", entity.ProductName ?? string.Empty);
     SqlHelper.AddParamInputId(cmd, "@ProductSubCategoryId", entity.ProductSubCategoryId.Value);
     SqlHelper.AddParamVarchar(cmd, "@Size", entity.Size ?? string.Empty);
     SqlHelper.AddParamMoney(cmd, "@RetailPrice", entity.RetailPrice);
     SqlHelper.AddParamInputId(cmd, "@ProductBrandId", entity.ProductBrandId.Value);
     SqlHelper.AddParamVarchar(cmd, "@ManufacturerBarcode", entity.ManufacturerBarcode ?? string.Empty);
     SqlHelper.AddParamVarchar(cmd, "@ManufacturerPartNum", entity.ManufacturerPartNum ?? string.Empty);
     SqlHelper.AddParamVarchar(cmd, "@ShelfOrder", entity.ShelfOrder ?? string.Empty);
     SqlHelper.AddParamMoney(cmd, "@RetailPriceOverride", entity.RetailPriceOverride);
     SqlHelper.AddParamVarchar(cmd, "@VendorPartNum", entity.VendorPartNum ?? string.Empty);
     SqlHelper.AddParamMoney(cmd, "@CaseCost", entity.CaseCost);
     SqlHelper.AddParamInt(cmd, "@CountInCase", entity.CountInCase);
     SqlHelper.AddParamMoney(cmd, "@EachCost", entity.EachCost);
     SqlHelper.AddParamTinyint(cmd, "@PreferredSource", entity.PreferredSource);
     SqlHelper.AddParamTinyint(cmd, "@WholeCasesOnly", entity.WholeCasesOnly);
 }
 public List <Vendor> GetBySubCategoryUse(ProductSubCategoryId subCategoryId)
 {
     return(Search("dbo.GetVendorsBySubCategoryUse", delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@ProductSubCategoryId", subCategoryId.Value);
     }));
 }
        public List <PurOrderSummary> GetByVendorProduct(VendorProductId vendorProductId)
        {
            List <PurOrderSummary> results = new List <PurOrderSummary>();

            using (PooledConnection pooledCon = GetPooledConnection())
            {
                using (SqlCommand cmd = SqlHelper.CreateProc("dbo.GetPurOrderByVendorProduct", pooledCon))
                {
                    SqlHelper.AddParamInputId(cmd, "@VendorProductId", vendorProductId.Value);
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            PurOrderSummary sum = new PurOrderSummary();
                            sum.VendorId   = new VendorId((int)reader["VendorId"]);
                            sum.PurOrderId = new PurOrderId((int)reader["PurOrderId"]);
                            sum.OrderDate  = (DateTime)reader["OrderDate"];
                            sum.QtyOrdered = (int)reader["QtyOrdered"];
                            object orderedEaches = reader["OrderedEaches"];
                            sum.OrderedEaches = (byte)orderedEaches != 0;
                            if (sum.OrderedEaches)
                            {
                                sum.EachesEquivalent = sum.QtyOrdered;
                            }
                            else
                            {
                                sum.EachesEquivalent = sum.QtyOrdered * (int)reader["CountInCase"];
                            }
                            results.Add(sum);
                        }
                    }
                }
            }
            return(results);
        }
Example #4
0
 public List <PurLine> GetInShelfOrder(PurOrderId orderId)
 {
     return(Search("dbo.GetPurLineByShelfOrder",
                   delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@OrderId", orderId.Value);
     }));
 }
Example #5
0
 public void SaveToDefinitions(PurOrderId orderId)
 {
     ExecuteNonQuery("dbo.PurLineSaveToDefinitions",
                     delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@OrderId", orderId.Value);
     });
 }
Example #6
0
 public List <ProductCategory> GetCategories(PurOrderId orderId)
 {
     return(mCategoryRep.Search("dbo.PurLineGetCategories",
                                delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@OrderId", orderId.Value);
     }));
 }
Example #7
0
 public void RefreshFromDefinitions(VendorId vendorId)
 {
     ExecuteNonQuery("dbo.PurLineRefreshFromDefinitions",
                     delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@VendorId", vendorId.Value);
     });
 }
 public List <VendorProduct> Get(ProductId productId)
 {
     return(Search("dbo.GetVendorProductsByProduct",
                   delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@ProductId", productId.Value);
     }));
 }
 public List <Product> Get(VendorId vendorId)
 {
     return(Search("dbo.GetProductsByVendor",
                   delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@VendorId", vendorId.Value);
     }));
 }
 public List <VendorProduct> Get(VendorId vendorId, string vendorPartNum)
 {
     return(Search("dbo.GetVendorProductsByPartNum",
                   delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@VendorId", vendorId.Value);
         SqlHelper.AddParamVarchar(cmd, "@VendorPartNum", vendorPartNum);
     }));
 }
 public List <Product> Get(ProductBrandId brandId, ProductCategoryId productCategoryId)
 {
     return(Search("dbo.GetProductsByBrandCategory",
                   delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@BrandId", brandId.Value);
         SqlHelper.AddParamInputId(cmd, "@ProductCategoryId", productCategoryId.Value);
     }));
 }
 public List <VendorProduct> Get(VendorId vendorId, ProductCategoryId productCategoryId)
 {
     return(Search("dbo.GetVendorProductsByVendorCategory",
                   delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@VendorId", vendorId.Value);
         SqlHelper.AddParamInputId(cmd, "@ProductCategoryId", productCategoryId.Value);
     }));
 }
 protected override void AddInsertUpdateParams(SqlCommand cmd, ProductSubCategory entity)
 {
     SqlHelper.AddParamVarchar(cmd, "@SubCategoryName", entity.SubCategoryName ?? string.Empty);
     SqlHelper.AddParamVarchar(cmd, "@SortCode", entity.SortCode ?? string.Empty);
     SqlHelper.AddParamInputId(cmd, "@ProductCategoryId", entity.ProductCategoryId.Value);
     SqlHelper.AddParamInt(cmd, "@DefaultProfitMargin", entity.DefaultProfitMargin);
     SqlHelper.AddParamTinyint(cmd, "@PricingRequiresReview", entity.PricingRequiresReview);
     SqlHelper.AddParamVarchar(cmd, "@Notes", entity.Notes ?? string.Empty);
     SqlHelper.AddParamTinyint(cmd, "@IsActive", entity.IsActive);
 }
Example #14
0
 public void AddCategory(PurOrderId orderId, ProductCategoryId categoryId, bool includeInactive)
 {
     ExecuteNonQuery("dbo.PurLineAddCategory",
                     delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@OrderId", orderId.Value);
         SqlHelper.AddParamInputId(cmd, "@CategoryId", categoryId.Value);
         SqlHelper.AddParamInt(cmd, "@IncludeInactive", includeInactive ? 1 : 0);
     });
 }
 public List <Product> Get(ProductBrandId brandId, string productName, string size)
 {
     return(Search("dbo.GetProductsByBrandNameSize",
                   delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@BrandId", brandId.Value);
         SqlHelper.AddParamVarchar(cmd, "@ProductName", productName);
         SqlHelper.AddParamVarchar(cmd, "@Size", size);
     }));
 }
Example #16
0
        public int RemoveCategory(PurOrderId orderId, ProductCategoryId categoryId)
        {
            SqlParameter outputParam = null;

            ExecuteNonQuery("dbo.PurLineRemoveCategory",
                            delegate(SqlCommand cmd)
            {
                SqlHelper.AddParamInputId(cmd, "@OrderId", orderId.Value);
                SqlHelper.AddParamInputId(cmd, "@CategoryId", categoryId.Value);
                outputParam = SqlHelper.AddParamOutputInt(cmd, "@LinesRemaining");
            });
            return((int)outputParam.Value);
        }
Example #17
0
 protected override void AddInsertUpdateParams(SqlCommand cmd, PurOrder entity)
 {
     SqlHelper.AddParamInputId(cmd, "@VendorId", entity.VendorId.Value);
     SqlHelper.AddParamVarchar(cmd, "@OrderNumber", entity.OrderNumber ?? string.Empty);
     SqlHelper.AddParamDatetime(cmd, "@OrderDate", entity.OrderDate);
     SqlHelper.AddParamDatetime(cmd, "@ShipDate", entity.ShipDate);
     SqlHelper.AddParamDatetime(cmd, "@SubmitDate", entity.SubmitDate);
     SqlHelper.AddParamVarchar(cmd, "@CreatedBy", entity.CreatedBy ?? string.Empty);
     SqlHelper.AddParamInt(cmd, "@Discount", entity.Discount);
     SqlHelper.AddParamVarchar(cmd, "@InvoiceNumber", entity.InvoiceNumber ?? string.Empty);
     SqlHelper.AddParamMoney(cmd, "@Freight", entity.Freight);
     SqlHelper.AddParamVarchar(cmd, "@Terms", entity.Terms ?? string.Empty);
     SqlHelper.AddParamVarchar(cmd, "@Notes", entity.Notes ?? string.Empty);
     SqlHelper.AddParamTinyint(cmd, "@Imported", entity.Imported);
 }
Example #18
0
 protected override void AddInsertUpdateParams(SqlCommand cmd, Vendor entity)
 {
     SqlHelper.AddParamVarchar(cmd, "@VendorName", entity.VendorName ?? string.Empty);
     SqlHelper.AddParamVarchar(cmd, "@Terms", entity.Terms ?? string.Empty);
     SqlHelper.AddParamInt(cmd, "@PriceCode", entity.PriceCode);
     SqlHelper.AddParamVarchar(cmd, "@Shipping", entity.Shipping ?? string.Empty);
     SqlHelper.AddParamVarchar(cmd, "@SortCode", entity.SortCode ?? string.Empty);
     SqlHelper.AddParamInputId(cmd, "@RepContactId", entity.RepContactId.Value);
     SqlHelper.AddParamInputId(cmd, "@OrdContactId", entity.OrdContactId.Value);
     SqlHelper.AddParamInputId(cmd, "@ShpContactId", entity.ShpContactId.Value);
     SqlHelper.AddParamInputId(cmd, "@ActContactId", entity.ActContactId.Value);
     SqlHelper.AddParamVarchar(cmd, "@Notes", entity.Notes ?? string.Empty);
     SqlHelper.AddParamTinyint(cmd, "@PreferredVendor", entity.PreferredVendor);
     SqlHelper.AddParamTinyint(cmd, "@IsActive", entity.IsActive);
     SqlHelper.AddParamTinyint(cmd, "@PricingRequiresReview", entity.PricingRequiresReview);
     SqlHelper.AddParamMoney(cmd, "@MinimumOrder", entity.MinimumOrder);
 }
Example #19
0
 protected override void AddInsertUpdateParams(SqlCommand cmd, VendorProduct entity)
 {
     SqlHelper.AddParamInputId(cmd, "@VendorId", entity.VendorId.Value);
     SqlHelper.AddParamInputId(cmd, "@ProductId", entity.ProductId.Value);
     SqlHelper.AddParamMoney(cmd, "@RetailPriceOverride", entity.RetailPriceOverride);
     SqlHelper.AddParamVarchar(cmd, "@VendorPartNum", entity.VendorPartNum ?? string.Empty);
     SqlHelper.AddParamMoney(cmd, "@CaseCost", entity.CaseCost);
     SqlHelper.AddParamInt(cmd, "@CountInCase", entity.CountInCase);
     SqlHelper.AddParamMoney(cmd, "@EachCost", entity.EachCost);
     SqlHelper.AddParamTinyint(cmd, "@PreferredSource", entity.PreferredSource);
     SqlHelper.AddParamTinyint(cmd, "@IsActive", entity.IsActive);
     SqlHelper.AddParamTinyint(cmd, "@PricingRequiresReview", entity.PricingRequiresReview);
     SqlHelper.AddParamTinyint(cmd, "@NumAndCostRequireReview", entity.NumAndCostRequireReview);
     SqlHelper.AddParamDatetime(cmd, "@CostVerifiedDate", entity.CostVerifiedDate);
     SqlHelper.AddParamVarchar(cmd, "@ShelfOrder", entity.ShelfOrder ?? string.Empty);
     SqlHelper.AddParamTinyint(cmd, "@IsProductDeleted", entity.IsProductDeleted);
     SqlHelper.AddParamTinyint(cmd, "@WholeCasesOnly", entity.WholeCasesOnly);
     SqlHelper.AddParamVarchar(cmd, "@Notes", entity.Notes ?? string.Empty);
 }
Example #20
0
 protected override void AddInsertUpdateParams(SqlCommand cmd, Product entity)
 {
     SqlHelper.AddParamVarchar(cmd, "@ProductName", entity.ProductName ?? string.Empty);
     SqlHelper.AddParamInputId(cmd, "@ProductSubCategoryId", entity.ProductSubCategoryId.Value);
     SqlHelper.AddParamVarchar(cmd, "@Size", entity.Size ?? string.Empty);
     SqlHelper.AddParamMoney(cmd, "@RetailPrice", entity.RetailPrice);
     SqlHelper.AddParamInputId(cmd, "@ProductBrandId", entity.ProductBrandId.Value);
     SqlHelper.AddParamVarchar(cmd, "@ManufacturerBarcode", entity.ManufacturerBarcode ?? string.Empty);
     SqlHelper.AddParamVarchar(cmd, "@ManufacturerPartNum", entity.ManufacturerPartNum ?? string.Empty);
     SqlHelper.AddParamTinyint(cmd, "@IsActive", entity.IsActive);
     SqlHelper.AddParamTinyint(cmd, "@PricingRequiresReview", entity.PricingRequiresReview);
     SqlHelper.AddParamTinyint(cmd, "@ExceptionalRetailPrice", entity.ExceptionalRetailPrice);
     SqlHelper.AddParamTinyint(cmd, "@IsProductDeleted", entity.IsProductDeleted);
     SqlHelper.AddParamTinyint(cmd, "@MultipleVendors", entity.MultipleVendors);
     SqlHelper.AddParamInt(cmd, "@QtyBusyMin", entity.QtyBusyMin);
     SqlHelper.AddParamInt(cmd, "@QtyBusyMax", entity.QtyBusyMax);
     SqlHelper.AddParamInt(cmd, "@QtySlowMin", entity.QtySlowMin);
     SqlHelper.AddParamInt(cmd, "@QtySlowMax", entity.QtySlowMax);
     SqlHelper.AddParamVarchar(cmd, "@Notes", entity.Notes ?? string.Empty);
     SqlHelper.AddParamMoney(cmd, "@RetailPrice2", entity.RetailPrice2);
     SqlHelper.AddParamMoney(cmd, "@Price2SizeMultiplier", entity.Price2SizeMultiplier);
 }
        public List <BrandUsageSummary> Get(ProductBrandId productBrandId)
        {
            List <BrandUsageSummary> results = new List <BrandUsageSummary>();

            using (PooledConnection pooledCon = GetPooledConnection())
            {
                using (SqlCommand cmd = SqlHelper.CreateProc("dbo.GetVendorCategoryByBrand", pooledCon))
                {
                    SqlHelper.AddParamInputId(cmd, "@ProductBrandId", productBrandId.Value);
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            BrandUsageSummary sum = new BrandUsageSummary();
                            sum.VendorId   = new VendorId((int)reader["VendorId"]);
                            sum.CategoryId = new ProductCategoryId((int)reader["ProductCategoryId"]);
                            results.Add(sum);
                        }
                    }
                }
            }
            return(results);
        }