public void AddSaleItems(Mehsul mehsul, int count) { Mehsul mehsul1 = new Mehsul(mehsul.Name, mehsul.Price, mehsul.Kateqoriya, mehsul.Count, mehsul.Kod); SalesItems salesItems = new SalesItems(mehsul1) { Count = count }; foreach (var item in Sales) { if (item.No == Helper.FindSalesNo()) { item.SalesItems.Add(salesItems); item.TotalAmount += mehsul.Price * count; mehsul.Count -= count; foreach (var salesitems in item.SalesItems) { if (salesitems.No == Helper.FindSalesItemDynamicNo()) { salesitems.Count = count; } } } } }
public static SalesItems FindSalesItemsBySalesNo(int no, int salesitemno) { Satis satis = Program.MarketMenu.Sales.Find(n => n.No == no); SalesItems salesItems = satis.SalesItems.Find(n => n.No == salesitemno); return(salesItems); }
public void AddNewSale(Mehsul mehsuls, int count) { Mehsul mehsul = new Mehsul(mehsuls.Name, mehsuls.Price, mehsuls.Kateqoriya, mehsuls.Count, mehsuls.Kod); if (count > 0 && Products.Exists(p => p.Kod == mehsul.Kod)) { SalesItems salesItems = new SalesItems(mehsul) { Count = count }; List <SalesItems> salesItemsList = new List <SalesItems>(); salesItemsList.Add(salesItems); Satis satis = new Satis(salesItemsList); Sales.Add(satis); mehsuls.Count -= count; } }