public void UpdateStockRecord(int IdStoreClerk, List <int> IdDisbursementItem) { foreach (int x in IdDisbursementItem) { DisbursementItem disbursementItem = context.DisbursementItems .Where(di => di.IdDisbursementItem == x) .FirstOrDefault(); Operation operation = context.Operations.Where(o => o.IdOperation == 1).FirstOrDefault(); Item item = context.Items.Where(i => i.IdItem == disbursementItem.IdItem).FirstOrDefault(); Employee storeclerk = context.Employees.Where(e => e.IdEmployee == IdStoreClerk).FirstOrDefault(); Disbursement disbursement = context.Disbursements .Where(d => d.IdDisbursement == disbursementItem.IdDisbursement).FirstOrDefault(); Department department = context.Departments .Where(dpt => dpt.CodeDepartment.Equals(disbursement.CodeDepartment)).FirstOrDefault(); Supplier supplier = context.Suppliers.Where(s => s.CodeSupplier == item.CodeSupplier1).FirstOrDefault(); StockRecord stockrecord = new StockRecord(); stockrecord.Date = DateTime.Now; stockrecord.IdDepartment = disbursement.CodeDepartment; stockrecord.Department = department; stockrecord.IdOperation = 1; stockrecord.Operation = operation; stockrecord.IdItem = disbursementItem.IdItem; stockrecord.Item = item; stockrecord.IdSupplier = item.CodeSupplier1; stockrecord.Supplier = supplier; stockrecord.IdStoreClerk = IdStoreClerk; stockrecord.StoreClerk = storeclerk; stockrecord.Unit = disbursementItem.UnitIssued; context.StockRecords.Add(stockrecord); context.SaveChanges(); } }
//@Shutong public PurchaseOrder UpdateStatusToDelivered(int purchaseOrderID) { //need to ask the user to input delivered amount and delivery Remarks PurchaseOrder po = context.PurchaseOrders.OfType <PurchaseOrder>().Where(x => x.IdPurchaseOrder == purchaseOrderID). Include(c => c.Status). Include(c => c.Supplier). Include(c => c.StoreClerk). Include(c => c.PurchaseOrderDetails). Include(x => x.PurchaseOrderDetails.Select(c => c.Item)). FirstOrDefault(); po.Status = context.Status.OfType <Status>().Where(x => x.Label.Equals("Delivered")).FirstOrDefault(); po.DeliverDate = DateTime.Now; foreach (PurchaseOrderDetail pod in po.PurchaseOrderDetails) { //also need to create a stock record StockRecord stockRecord = new StockRecord(); stockRecord.Supplier = po.Supplier; stockRecord.StoreClerk = po.StoreClerk; stockRecord.Operation = context.Operations.OfType <Operation>().Where(x => x.Label.Equals("Delivery")).FirstOrDefault(); stockRecord.Date = DateTime.Now; stockRecord.Item = pod.Item; //add stockunit and available unit stockRecord.Item.StockUnit += pod.DeliveredUnit; stockRecord.Item.AvailableUnit += pod.DeliveredUnit; stockRecord.Unit = pod.DeliveredUnit; //add the stock record context.StockRecords.Add(stockRecord); } context.SaveChanges(); return(po); }
static void Main(string[] args) { // create an array of Fruit objects Fruit[] fruitArray = new Fruit[] { new Fruit("apple", 100), new Fruit("plum", 101), new Fruit("cherry", 102) }; // create an array of StockRecords StockRecord[] stockRecords = new StockRecord[] { new StockRecord(100, 50), new StockRecord(101, 10), new StockRecord(102, 500) }; // define the query var results = from fruit in fruitArray join stock in stockRecords on fruit.StockCode equals stock.StockCode select new { Name = fruit.Name, StockCode = fruit.StockCode, ItemsInStock = stock.ItemsInStock }; // enumerate the results foreach (var item in results) { Console.WriteLine("Name: {0}, Code: {1} Stock Level: {2}", item.Name, item.StockCode, item.ItemsInStock); } // wait for input before exiting Console.WriteLine("Press enter to finish"); Console.ReadLine(); }
public static double GetAllStockPrice(double stockPrice, string currency, int deliveryToUSA, double VatValue) { var stockRecord = new StockRecord(); var price = ((stockPrice) * (1 - VatValue)) + deliveryToUSA; if (currency == "USD") { return(Math.Round(price, 2)); } //stockRecord.price = (stockPrice + deliveryToUSA) * (1 - VatValue); //stockRecord.sellPrice = stockRecord.price; //var price2 = Exporter.GetPrice2(stockPrice, VatValue, deliveryToUSA, 0, currency, "USD"); CurrencyRate currate = CurrencyRate.ReadObjectFromJsonFile(); double curInputRate = currate.GetCurrencyRate(currency); double curOutputRate = currate.GetCurrencyRate("USD"); double curInputRateBuy = curInputRate * 1.035; double curOutputRateSell = curOutputRate * 0.965; var resultPrice = price * curInputRateBuy / curOutputRateSell; var oldResultPrice = price * curInputRate / curOutputRate; resultPrice = Math.Round(resultPrice, 2); //var resultPrice = Exporter.GetPrice(stockRecord, currency, "USD"); return(resultPrice); //throw new NotImplementedException(); }
}//GetCostPrice //-------------------------------------------------------------------------------------------------------// /// <summary> /// Make sure all objects are released for garbage collection. /// </summary> public void DestroyAllObjects() { if (salesRecord != null) { Marshal.FinalReleaseComObject(salesRecord); salesRecord = null; }//If if (currencyData != null) { Marshal.FinalReleaseComObject(currencyData); currencyData = null; }//If if (stockRecord != null) { Marshal.FinalReleaseComObject(stockRecord); stockRecord = null; }//If if (ws != null) { ws.Disconnect(); Marshal.FinalReleaseComObject(ws); ws = null; }//If if (sdo != null) { Marshal.FinalReleaseComObject(sdo); sdo = null; } //If } //DestroyAllObjects
}//GetTakenBy //----------------------------------------------------------------------------------------------// private void AddItem(Models.Product product, WorkSpace ws) { stockRecord = (StockRecord)ws.CreateObject("StockRecord"); //Create a stockRecord with lvi.Text and look for it in database. SDOHelper.Write(stockRecord, "STOCK_CODE", product.Code); if (stockRecord.Find(false)) { //Add item to the order. sopItem = SDOHelper.Add(sopPost.Items); //Put product details and prices into sopItem SDOHelper.Write(sopItem, "STOCK_CODE", SDOHelper.Read(stockRecord, "STOCK_CODE")); SDOHelper.Write(sopItem, "DESCRIPTION", SDOHelper.Read(stockRecord, "DESCRIPTION")); double qty = product.Qty; double salePrc = product.SalePrice; double netAmt = salePrc * qty * (1 - cusDiscountRate / 100); double taxAmt = netAmt * defTaxRate / 100; SDOHelper.Write(sopItem, "QTY_ORDER", qty); SDOHelper.Write(sopItem, "UNIT_PRICE", salePrc); SDOHelper.Write(sopItem, "NET_AMOUNT", netAmt); SDOHelper.Write(sopItem, "TAX_AMOUNT", taxAmt); SDOHelper.Write(sopItem, "TAX_RATE", defTaxRate); SDOHelper.Write(sopItem, "NOMINAL_CODE", ((int)setUsr.stockNomCode).ToString()); SDOHelper.Write(sopItem, "TAX_CODE", (short)taxCode); } else { throw new MyException("Stock: " + product.Code + " does not seem to exist."); } //Else } //AddItem
public async Task <IActionResult> UpdatePrice([FromBody] StockRecord product) { var orgId = getOrg(); if (product != null) { var prod = _context.StockRecords.Where(x => x.Id == product.Id).FirstOrDefault(); prod.SellingPrice = product.SellingPrice; prod.ProfitPercent = product.ProfitPercent; try { _context.Update(prod); await _context.SaveChangesAsync(); return(Json(new { msg = "Success" })); } catch { return(Json(new { msg = "Failed" })); } } return(Json(new { msg = "No Data" })); }
private Sneaker GetSneaker(StockRecord stockRecord) { //провекра на существование в постинг листе bool isPostList = this.post_list.ContainsKey(stockRecord.sku); if (isPostList) { return(null); } //проверяем есть ли этот артикул в списке var sneaker = avitoCatalog.GetSneakerFromSKU(stockRecord.sku); if (sneaker == null) //добавляем новый кросс { sneaker = catalog.GetSneakerFromSKU(stockRecord.sku); if (sneaker == null) { Program.Logger.Info("is not exist in catalog"); return(null); } } return(sneaker); }
public void SaveStockToCSV(string FileName) { string filenameCatalog = FileName; int count = this.sneakers.Count; var stock = new OnlineShopStock(); //List<StockRecord> stock = new List<StockRecord>(); for (int i = 0; i < count; i++) { for (int j = 0; j < this.sneakers[i].sizes.Count; j++) { StockRecord record = new StockRecord(); Sneaker sneaker = this.sneakers[i]; record.sku = sneaker.sku; record.upc = sneaker.sizes[j].upc; record.title = sneaker.title; record.price = sneaker.price; record.oldPrice = sneaker.oldPrice; record.sellPrice = sneaker.sellPrice; record.quantity = 1; record.link = sneaker.link; record.size = sneaker.sizes[j].sizeUS; stock.records.Add(record); } } stock.SaveStockToCSV(FileName); }
private async Task <CommandResponse> ProcessLine(StockRecord record, Guid userId) { RequestWithUserId <CommandResponse> cmd = null; switch (record.type) { case "buy": var b = new core.Stocks.Buy.Command { NumberOfShares = record.amount, Date = record.date, Price = record.price, Ticker = record.ticker, }; b.WithUserId(userId); cmd = b; break; case "sell": var s = new core.Stocks.Sell.Command { NumberOfShares = record.amount, Date = record.date, Price = record.price, Ticker = record.ticker, }; s.WithUserId(userId); cmd = s; break; } return(await _mediator.Send(cmd)); }
public void UpdateVoucherToRejected(List <StockRecord> vouchers) { foreach (StockRecord voucher in vouchers) { StockRecord temp = context.StockRecords .Where(x => x.IdStockRecord == voucher.IdStockRecord) .FirstOrDefault(); if (temp.IdOperation == 3) { temp.IdOperation = 8; } else if (temp.IdOperation == 4) { temp.IdOperation = 10; } else if (temp.IdOperation == 5) { temp.IdOperation = 11; } else if (temp.IdOperation == 6) { temp.IdOperation = 13; } context.SaveChanges(); } }
//James internal void StockAdjustmentDuringDisbursement(int qtyDisbursed, DisbursementItem di, int idStoreClerk) { // 1. Raise SA for damaged good for approval StockRecord raiseSA = new StockRecord { Date = DateTime.Now, IdOperation = 5, IdDepartment = di.Disbursement.CodeDepartment, IdStoreClerk = idStoreClerk, IdItem = di.IdItem, Unit = (di.UnitIssued - qtyDisbursed) * -1 }; context.StockRecords.Add(raiseSA); // 2. Create reversal StockRecord transaction for unit issued to the department StockRecord reverseSr = new StockRecord { Date = DateTime.Now, IdOperation = 1, IdDepartment = di.Disbursement.CodeDepartment, IdStoreClerk = idStoreClerk, IdItem = di.IdItem, Unit = di.UnitIssued - qtyDisbursed }; context.StockRecords.Add(reverseSr); context.SaveChanges(); }
public void SetParameters(StockRecord stockRecord) { kod_tovara = stockRecord.sku + "-" + stockRecord.size; identifikator_tovara = kod_tovara; id_gruppi_raznovidnostej = stockRecord.sku.Replace("-", ""); znachenie_harakteristiki_razmer = stockRecord.size; proizvoditel = "Nike"; }
public async Task <IEnumerable <IDictionary <string, string> > > Get(string name, DateTime from, DateTime to) { var client = new MongoClient("mongodb://*****:*****@ds030719.mlab.com:30719/yhstock"); var db = client.GetDatabase("yhstock"); var collection = db.GetCollection <StockRecord>("yhstock"); var unixStart = new DateTime(1970, 1, 1); var begin = (int)(from - unixStart).TotalDays; var end = (int)(to - unixStart).TotalDays; var stockList = await(await collection .FindAsync(b => b.StockName == name && b.Date >= begin && b.Date <= end)) .ToListAsync(); if (stockList.Count() == end - begin + 1) { var result = new List <IDictionary <string, string> >(); foreach (var stockRecord in stockList) { var jsonStr = stockRecord.HistoryRecord.ToJson(); var recordDict = JsonConvert.DeserializeObject <Dictionary <string, string> >(jsonStr); recordDict["Date"] = stockRecord.Date.ToString(); result.Add(recordDict); } return(result); } else { var result = await(new FromYahooStock()).Get(name, from, to); foreach (var recordDict in result) { var jsonStr = recordDict.ToJson(); var stockHistoryRecord = JsonConvert.DeserializeObject <StockHistoryRecord>(jsonStr); var stockRecord = new StockRecord { StockName = name, Date = int.Parse(recordDict["Date"]), HistoryRecord = stockHistoryRecord, Id = ObjectId.GenerateNewId() }; //stockRecord.Id = new ObjectId(name + stockRecord.Date.ToString()); if (null == stockList.Find(b => b.StockName == name && b.Date == stockRecord.Date)) { collection.InsertOne(stockRecord); } else { //collection.FindOneAndReplace(b => b.StockName == name //&& b.Date == stockRecord.Date, stockRecord); } } return(result); } }
}//ctor //-------------------------------------------------------------------------------------------------------// public double GetCostPrice(string prodCode) { //Create product with prodCode stockRecord = (StockRecord)ws.CreateObject("StockRecord"); SDOHelper.Write(stockRecord, "STOCK_CODE", prodCode); var result = stockRecord.Find(false); return((double)SDOHelper.Read(stockRecord, "LAST_PURCHASE_PRICE")); }//GetCostPrice
private void btn_add_Click(object sender, EventArgs e) { //Add to item list StockRecord selected = _items[cmb_name.SelectedIndex]; _saleItems.Add(new ItemSaleRecord(0, selected.StockID, selected.CurrentSell, int.Parse(txt_quantity.Text), selected.StockName)); //Add to table string[] row = new string[] { (_saleItems.Count + 1).ToString(), selected.StockID.ToString(), selected.StockName, txt_quantity.Text, selected.CurrentSell.ToString(), "Remove" }; dg_data.Rows.Add(row); }
public StockRecord GetStockRecord(StockRecord stockRecord) { for (int i = 0; i < this.StockRecords.Count; i++) { if (StockRecords[i].sku == stockRecord.sku && StockRecords[i].size == stockRecord.size) { return(StockRecords[i]); } } return(null); }
private async Task <CommandResponse> ProcessLine(StockRecord record, Guid userId) { RequestWithUserId <CommandResponse> CreateBuy(StockRecord r) { var b = new core.Stocks.Buy.Command { NumberOfShares = record.amount, Date = record.date, Price = record.price, Ticker = record.ticker, }; b.WithUserId(userId); return(b); } RequestWithUserId <CommandResponse> CreateSell(StockRecord r) { var s = new core.Stocks.Sell.Command { NumberOfShares = record.amount, Date = record.date, Price = record.price, Ticker = record.ticker, }; s.WithUserId(userId); return(s); } RequestWithUserId <CommandResponse> cmd = null; switch (record.type) { case "buy": cmd = CreateBuy(record); break; case "sell": cmd = CreateSell(record); break; } try { return(await _mediator.Send(cmd)); } catch (Exception ex) { return(CommandResponse.Failed( $"Entry for {record.ticker}/{record.type}/{record.date.Value.ToString("yyyy-MM-dd")} failed: {ex.Message}" )); } }
public async Task <IActionResult> AddNewProduct([FromBody] ProductService product) { var orgId = getOrg(); if (product != null) { product.Id = Guid.NewGuid(); product.OrganisationId = orgId; try { _context.Add(product); await _context.SaveChangesAsync(); StockRecord newStock = new StockRecord() { Id = Guid.NewGuid(), ProductServiceId = product.Id, AllTimeQuantity = 0, QuantitySold = 0, QuantityRemain = 0, OrganisationId = orgId }; _context.Add(newStock); await _context.SaveChangesAsync(); return(Json(new { msg = "Success" })); } catch { return(Json(new { msg = "Failed" })); } //StatusMessage = "New Vendor successfully created."; } //StatusMessage = "Error! Check fields..."; //ViewData["StatusMessage"] = StatusMessage; return(Json(new { msg = "No Data" })); }
public StockRecord FindById(int voucherId) { StockRecord voucher = context.StockRecords .Where(x => x.IdStockRecord == voucherId) .Include(x => x.StoreClerk) .Include(x => x.Item) .Include(x => x.Operation) .Include(x => x.Supplier) .FirstOrDefault(); return(voucher); }
public static double GetPrice2(double price, double vat_value, int delivery_to_usa, int marzha, string currencyInput, string currencyOutput) { double resultprice; var sebestoimost = ((price) * (1 - vat_value)) + delivery_to_usa; var sebestWithMarzha = sebestoimost + marzha - delivery_to_usa; //маржа идет уже плюсом с доставкой, поэтому вычитаем ее var stockRecord = new StockRecord(); stockRecord.sellPrice = sebestWithMarzha; resultprice = Exporter.GetPrice(stockRecord, currencyInput, currencyOutput); return(resultprice); }
internal void RaiseSA(DateTime date, int idOperation, String idDepartment, String idSupplier, int idStoreClerk, int idItem, int unit) { StockRecord sr = new StockRecord { Date = date, IdOperation = idOperation, IdDepartment = idDepartment, IdSupplier = idSupplier, IdStoreClerk = idStoreClerk, IdItem = idItem, Unit = unit }; context.StockRecords.Add(sr); context.SaveChanges(); }
}//readCustomerData //-------------------------------------------------------------------------------------------------------// /// <summary> /// Reads all products and stores it's values in a List. /// </summary> /// <param name="customersFileName"></param> public MyDictionary<Models.Product> ReadProductData() { MyDictionary<Models.Product> productMap = new MyDictionary<Models.Product>(); //MyDictionary<MyDictionary<Product>> fastProductList = new MyDictionary<MyDictionary<Product>>(); try { sdo = new SDOEngine(); ws = (WorkSpace)sdo.Workspaces.Add("App Server Update"); ws.Connect(sageUsrSet.sageDBDir, sageUsrSet.sageUsername, sageUsrSet.sagePassword, "UniqueUpdater"); stockRecord = (StockRecord)ws.CreateObject("StockRecord"); string code = string.Empty; string desc = string.Empty; double costPrice = 0; double salePrice = 0; stockRecord.MoveFirst(); do { try { code = CutQuotes((string)SDOHelper.Read(stockRecord, "STOCK_CODE")); desc = (string)SDOHelper.Read(stockRecord, "DESCRIPTION"); costPrice = (double)SDOHelper.Read(stockRecord, "LAST_PURCHASE_PRICE"); salePrice = (double)SDOHelper.Read(stockRecord, "SALES_PRICE"); Models.Product product = new Models.Product(code, desc, costPrice); productMap.Add(code, product); } catch (Exception) { //Just skip product if it throws an exception }//Catch } while (stockRecord.MoveNext()); } finally { DestroyAllObjects(); }//finally return productMap; }//readProductData
private void buttonStore_Click(object sender, EventArgs e) { if (this.pluginBox1.RowItem.Id == (long)0) { return; } StockSelectWrapper stockSelectWrapper = new StockSelectWrapper(); stockSelectWrapper.StockFilter.StoreId = this.pluginBox1.RowItem.Id; if (stockSelectWrapper.Show() == System.Windows.Forms.DialogResult.OK) { StockRecord stockRecord = StockSelectWrapper.GetStockRecord(stockSelectWrapper.GridController.SelectedRow()); InvoiceAutoItem invoiceAutoItem = new InvoiceAutoItem() { Id_goods = stockRecord.IdGoods, Id_party = stockRecord.IdLot }; foreach (InvoiceAutoItem item in this.invoiceAuto.Items) { if (item.Id_goods != invoiceAutoItem.Id_goods || item.Id_party != invoiceAutoItem.Id_party) { continue; } return; } GOODS_BL bL = (GOODS_BL)BLProvider.Instance.GetBL(typeof(GOODS_BL)); invoiceAutoItem.Goods_name = ((GOODS)bL.Load(invoiceAutoItem.Id_goods)).NAME; LOT_BL lOTBL = (LOT_BL)BLProvider.Instance.GetBL(typeof(LOT_BL)); LOT lOT = lOTBL.Load(invoiceAutoItem.Id_party); if (lOT.QUANTITY_REM <= new decimal(0)) { return; } invoiceAutoItem.Store_quantity = lOT.QUANTITY_REM; invoiceAutoItem.Id_scale_ratio = lOT.ID_SCALING_RATIO; SCALING_RATIO_BL sCALINGRATIOBL = (SCALING_RATIO_BL)BLProvider.Instance.GetBL(typeof(SCALING_RATIO_BL)); SCALING_RATIO sCALINGRATIO = (SCALING_RATIO)sCALINGRATIOBL.Load(invoiceAutoItem.Id_scale_ratio); invoiceAutoItem.Scale_ratio_name = string.Concat(sCALINGRATIO.SCALING_RATIO_TEXT, ' ', sCALINGRATIO.UNIT_NAME); this.plInvoice.SetId((long)0); this.invoiceAuto.Items.Add(invoiceAutoItem); this.TransformData(); this.grdItems.BindingSource.CurrencyManager.Refresh(); } }
//Huang Yuzhe public void UpdateVoucherToApproved(List <StockRecord> vouchers) { foreach (StockRecord voucher in vouchers) { StockRecord temp = context.StockRecords .Where(x => x.IdStockRecord == voucher.IdStockRecord) .FirstOrDefault(); if (temp.IdOperation == 3) { Operation op = context.Operations .Where(o => o.IdOperation == 7) .FirstOrDefault(); temp.IdOperation = 7; temp.Operation = op; } else if (temp.IdOperation == 4) { Operation op = context.Operations .Where(o => o.IdOperation == 9) .FirstOrDefault(); temp.IdOperation = 9; temp.Operation = op; } else if (temp.IdOperation == 5) { Operation op = context.Operations .Where(o => o.IdOperation == 12) .FirstOrDefault(); temp.IdOperation = 12; temp.Operation = op; } else if (temp.IdOperation == 6) { Operation op = context.Operations .Where(o => o.IdOperation == 14) .FirstOrDefault(); temp.IdOperation = 14; temp.Operation = op; } context.SaveChanges(); } }
} //AddItem //----------------------------------------------------------------------------------------------// private void DestroyAllObjects() { if (conData != null) { Marshal.FinalReleaseComObject(conData); conData = null; }//If if (currData != null) { Marshal.FinalReleaseComObject(currData); currData = null; }//If if (sopPost != null) { Marshal.FinalReleaseComObject(sopPost); sopPost = null; }//If if (sopItem != null) { Marshal.FinalReleaseComObject(sopItem); sopItem = null; }//If if (stockRecord != null) { Marshal.FinalReleaseComObject(stockRecord); stockRecord = null; }//If if (ws != null) { ws.Disconnect(); Marshal.FinalReleaseComObject(ws); ws = null; }//If if (sdo != null) { Marshal.FinalReleaseComObject(sdo); sdo = null; } //If } //DestroyAllObjects
public ActionResult JudgeAdjustment(string judge, List <int> vouchersId) { List <StockRecord> vouchers = new List <StockRecord>(); foreach (int id in vouchersId) { StockRecord voucher = _stockRecordDAO.FindById(id); vouchers.Add(voucher); } if (judge == "Approve") { _stockRecordDAO.UpdateVoucherToApproved(vouchers); foreach (StockRecord sr in vouchers) { var hub = GlobalHost.ConnectionManager.GetHubContext <ChatHub>(); hub.Clients.All.receiveNotification(sr.IdStoreClerk); EmailClass emailClass = new EmailClass(); string message = "Hi," + sr.StoreClerk.Name + " your stock adjustment voucher for (" + sr.Operation.Label.Split('-')[1] + ") " + sr.Unit + " " + sr.Item.unitOfMeasure + sr.Item.Description + " raised on " + sr.Date + " has been approved."; _notificationChannelDAO.CreateNotificationsToIndividual(sr.StoreClerk.IdEmployee, (int)Session["IdEmployee"], message); emailClass.SendTo(sr.StoreClerk.Email, "SSIS System Email", message); } } else { _stockRecordDAO.UpdateVoucherToRejected(vouchers); foreach (StockRecord sr in vouchers) { var hub = GlobalHost.ConnectionManager.GetHubContext <ChatHub>(); hub.Clients.All.receiveNotification(sr.IdStoreClerk); EmailClass emailClass = new EmailClass(); string message = "Hi," + sr.StoreClerk.Name + " your stock adjustment voucher for (" + sr.Operation.Label.Split('-')[1] + ") " + sr.Unit + " " + sr.Item.unitOfMeasure + sr.Item.Description + " raised on " + sr.Date + " has been rejected."; _notificationChannelDAO.CreateNotificationsToIndividual(sr.StoreClerk.IdEmployee, (int)Session["IdEmployee"], message); emailClass.SendTo(sr.StoreClerk.Email, "SSIS System Email", message); } } return(RedirectToAction("Voucher", "StoreManager")); }
public int Insert(StockRecord stock) { using (var conn = ConnectionFactory.CreateSqlConnection()) { return(conn.Execute(@"INSERT INTO [dbo].[Stocks] ([Code] ,[Name] ,[DataDate] ,[OpeningPrice] ,[ClosingPrice] ,[HighestPrice] ,[LowestPrice] ,[PreClosingPrice] ,[BalancePrice] ,[BalanceRange] ,[TurnoverRate] ,[Volume] ,[TurnoverAmount] ,[TotalMarketCapitalisation] ,[FreeFloatMarketCapitalisation]) VALUES( @Code ,@Name ,@DataDate ,@OpeningPrice ,@ClosingPrice ,@HighestPrice ,@LowestPrice ,@PreClosingPrice ,@BalancePrice ,@BalanceRange ,@TurnoverRate ,@Volume ,@TurnoverAmount ,@TotalMarketCapitalisation ,@FreeFloatMarketCapitalisation)", stock)); } }
private bool AddToCatalog(StockRecord stockRecord, string category) { Sneaker sneaker = catalog.GetSneakerFromSKU(stockRecord.sku); if (sneaker == null) { sneaker = new Sneaker(); sneaker.sku = stockRecord.sku; sneaker.category = category; sneaker.title = stockRecord.title; sneaker.price = stockRecord.price; SneakerSize size = new SneakerSize(); size.sizeUS = stockRecord.size; size.GetAllSizesFromUS(sneaker, stockRecord.size); size.upc = stockRecord.upc; sneaker.sizes.Add(size); catalog.sneakers.Add(sneaker); } else { if (sneaker.GetSize(stockRecord.size) != null) { Program.Logger.Warn("Duplicate size. sku: " + stockRecord.sku + " size: " + stockRecord.size); return(false); } SneakerSize size = new SneakerSize(); size.sizeUS = stockRecord.size; size.GetAllSizesFromUS(sneaker, stockRecord.size); size.upc = stockRecord.upc; sneaker.sizes.Add(size); } return(true); }
/// <summary> /// получаем конечную цену (маржа и доставка уже включены) /// </summary> /// <param ftpFolder="price">себестоимость</param> /// <param ftpFolder="currency">валюта</param> /// <returns>возвращает конечную цену продажи</returns> public double GetPrice(StockRecord record, string currency, int Marzha = 0) { if (currency == "RUB" && Marzha == 0) { Marzha = marzha; //это для дисконта, там без маржи вызов функции, тут исправил а в других экспортерах возможно это осталось //но возможно у каких-то магазинов тоже это осталось } if (currency == "RUB") { Marzha = marzha; } double price = Exporter.GetPrice(record, currency, "RUB", Marzha); return(price); //double resultPrice; //if (currency == "USD") //{ // if (record.sellPrice > 0) // { // resultPrice = record.sellPrice; // return resultPrice * Settings.USD_SELL; // } // else // { // resultPrice = record.price + Marzha; // return resultPrice * Settings.USD_BUY; // //throw new Exception("нет цены продажи sku:" + record.sku); // } //} //if (currency == "EUR") //{ // if (record.sellPrice > 0) // { // resultPrice = record.sellPrice * Settings.EURO_BUY; // return resultPrice; // } // else // { // if (Marzha == 0) // throw new Exception("marzha = 0. sku: " + record.sku); // record.sellPrice = record.price + Marzha; // resultPrice = record.sellPrice * Settings.EURO_BUY; // return resultPrice; // } //} //if (currency == "CHF") //{ // if (record.sellPrice > 0) // { // resultPrice = record.sellPrice * Settings.CHF_BUY; // return resultPrice; // } // else // { // throw new Exception("нет цены продажи sku:" + record.sku); // } //} //else if (currency == "RUB") //{ // var sneaker = catalog.GetSneakerFromSKU(record.sku); // if (sneaker != null) // { // if (sneaker.type == "Сланцы") // { // resultPrice = record.price + marzha; // return resultPrice; // } // } // resultPrice = record.price + marzha; // return resultPrice; //} //throw new NotImplementedException(); }