/// <summary> /// Save Price data for the specified store /// </summary> /// <param name="item"></param> private void SaveItemPrice(ItemPriceData item) { var ItemPriceData = new { ItemId = item.Item.Id, Barcode = item.Barcode, TaxId = item.Tax.Id, StoreId = item.Store.Id, RetailPrice = item.RetailPrice, UnitId = item.Unit.Id, UpdatedAt = DateTime.Today, CreatedAt = DateTime.Today }; using (IDbConnection cnx = new SqlConnection(CnxString)) { cnx.Execute("usp_InsertItemPrice", ItemPriceData, commandType: CommandType.StoredProcedure); } }
public ShopEntity(InventoryEntity inventory, ResourceEntity resources, ItemPriceData itemPriceData) { _inventory = inventory; _resources = resources; _itemPriceData = itemPriceData; }
private void ProcessProductImportRow(string[] pieces, string line, int lineNumber) { var processLine = true; if (pieces.Length < minimumSupportedColumnsForProduct) { AddError(line, lineNumber, "Invalid line - too few columns for PRODUCT"); processLine = false; } var productCode = pieces[productCodeColumn]; var productName = pieces[productNameColumn]; var productDescription = pieces[productDescriptionColumn]; var productClass = pieces[productClassNameColumn]; var productAccountingMethod = pieces[productAccountingTypeColumn]; AccountingMethodData accountingMethod; if (!Enum.TryParse(productAccountingMethod, true, out accountingMethod)) { AddError(line, lineNumber, String.Format("Invalid accounting method: {0}", pieces[productAccountingTypeColumn])); processLine = false; } var productTaxCategory = pieces[productTaxCategoryColumn]; decimal price; decimal discountPrice; processLine &= SetDecimalFromString(line, lineNumber, pieces[productPriceColumn], out price); processLine &= SetDecimalFromString(line, lineNumber, pieces[productDiscountPriceColumn], out discountPrice); if (processLine) { var product = new ProductItemData { Description = productDescription, ItemCode = productCode, Name = productName, ItemId = productCode, ItemClass = new ItemClassSummaryData {Name = productClass, ItemClassId = productClass}, TempDefaultPrice = price, ItemFinancialInformation = new ItemFinancialInformationData { AccountingMethod = accountingMethod, TaxCategory = new TaxCategorySummaryData {Name = productTaxCategory} } }; contractsToImport.Add(product); var standardPriceData = new ItemPriceData { PriceSheet = new PriceSheetSummaryData{PriceSheetId = CommerceSettings.DefaultPriceSheetId}, Item = product, DefaultPrice = new MonetaryAmountData(price, CommerceSettings.DefaultCurrency) }; var discountPriceData = new ItemPriceData { PriceSheet = new PriceSheetSummaryData { PriceSheetId = CommerceSettings.DefaultDiscountPriceSheetId }, Item = product, DefaultPrice = new MonetaryAmountData(discountPrice, CommerceSettings.DefaultCurrency) }; contractsToImport.Add(standardPriceData); contractsToImport.Add(discountPriceData); } }