private void AddDailyFlavor() { BatchWPF bat = new BatchWPF(); bat.Flavor = SelectedFlavor; if (AddDailyFlavorEvent != null) { AddDailyFlavorEvent(this, new DayInfoEventArg(bat)); } }
public bool DeleteBatch(BatchWPF Batch_WPF) { try { bool rtn = lck.DeleteBatch(Batch_WPF.Id); return(rtn); } catch (Exception ex) { Log("DeleteBatch(BatchWPF) - Error msg:" + ex.Message); return(false); } }
public bool UpdateBatch(int Batch_ID, BatchWPF Batch_WPF) { try { bool rtn = lck.UpdateBatch(Batch_ID, Batch_WPF.ToBatch()); return(rtn); } catch (Exception ex) { Log("UpdateBatch(int,BatchWPF) - Error msg:" + ex.Message); return(false); } }
public bool AddBatch(BatchWPF batch) { try { bool rtn = lck.AddBatch(batch.ToBatch()); return(rtn); } catch (Exception ex) { Log("AddFlavor(FlavorWPF) - Error msg:" + ex.Message); return(false); } }
public BatchWPF GetBatch(int BatchID) { try { Batch bat = lck.GetBatch(BatchID); BatchWPF batWPF = new BatchWPF(bat); return(batWPF); } catch (Exception ex) { Log("GetBatch(int) - Error msg:" + ex.Message); return(null); } }
public DayInfoWPF GetDayInfo(int StoreID, string DayNumber, bool appendSO2DailyFlavors = false) { try { DayInfo day = lck.GetDayInfo(StoreID, DayNumber); day.DayNumber = DayNumber; DayInfoWPF dayWPF = new DayInfoWPF(day); // extract all flavors from SOs and append to dailyBatches if (appendSO2DailyFlavors) { foreach (SpecialOrderWPF SO in dayWPF.Orders) { foreach (SO_BatchWPF bat in SO.Batches) { BatchWPF tmp = new BatchWPF(); tmp.Day_number = bat.Day_number; tmp.Store = bat.Store; tmp.Flavor = bat.Flavor; tmp.Quantity = bat.Quantity; tmp.Requested = true; tmp.IsMini = bat.IsMini; // check to see if item already in list BatchWPF found = dayWPF.DailyBatches.Find(x => x.Flavor.ID == tmp.Flavor.ID && x.IsMini == tmp.IsMini); if (found == null) { dayWPF.DailyBatches.Add(tmp); } } } } return(dayWPF); } catch (Exception ex) { Log("GetDayInfo(int,string,bool) - Error msg:" + ex.Message); return(null); } }
public DayInfoEventArg(BatchWPF BatchWPF) { this.Batch_WPF = BatchWPF; }
public DayInfoWPF GetDayInfo(string DayNumber, bool appendSO2DailyFlavors = false) { try { DayInfo day = lck.GetDayInfoAll(DayNumber); day.DayNumber = DayNumber; DayInfoWPF dayWPF = new DayInfoWPF(day); // extract all flavors from SOs and append to dailyBatches if (appendSO2DailyFlavors) { foreach (SpecialOrderWPF SO in dayWPF.Orders) { // extract flavor info from Special Orders and add to Daily Flavors panel foreach (SO_BatchWPF bat in SO.Batches) { BatchWPF tmp = new BatchWPF(); tmp.Day_number = bat.Day_number; tmp.Store = SO.Store; tmp.Flavor = bat.Flavor; tmp.Quantity = bat.Quantity; tmp.QuantityMini = bat.QuantityMini; tmp.Requested = true; tmp.IsMini = bat.IsMini; // check to see if item already in list BatchWPF found = dayWPF.DailyBatches.Find(x => x.Flavor.ID == tmp.Flavor.ID && x.IsMini == tmp.IsMini); if (found == null) { dayWPF.DailyBatches.Add(tmp); } else { // add qty found.Quantity += tmp.Quantity; found.QuantityMini += tmp.QuantityMini; // updated Request flag found.Requested = true; // check if at both locations if (found.Store.Name != tmp.Store.Name) { found.BothStores = true; } } } // extract Cake info from SO and add to Daily Flavors panel foreach (Cake_BatchWPF cakeBat in SO.Cakes) { BatchWPF tmp = new BatchWPF(); tmp.Day_number = SO.Day_Number; tmp.Store = SO.Store; // create temporary flavorWPF that I manipulate and make custom name for FlavorWPF flav = new FlavorWPF(); flav.Name = cakeBat.Cake.AbvName + " " + cakeBat.Flavor.Name; tmp.Flavor = flav; tmp.Quantity = cakeBat.Quantity; tmp.Requested = true; tmp.IsMini = false; // check if already present in list BatchWPF found = dayWPF.DailyBatches.Find(x => x.Flavor.Name == tmp.Flavor.Name); if (found == null) // not found, so add { dayWPF.DailyBatches.Add(tmp); } else // found so sum up quantities { found.Quantity += tmp.Quantity; } } } // scan thru all DailyBatches and combine mini and Full for same flavor List <BatchWPF> deleteList = new List <BatchWPF>(); for (int i = dayWPF.DailyBatches.Count - 1; i >= 0; i--) { BatchWPF current = dayWPF.DailyBatches[i]; List <BatchWPF> found = dayWPF.DailyBatches.FindAll(x => x.Flavor.Name == current.Flavor.Name); if (found.Count > 1) { // combine qty/qtyMini found[0].Quantity += found[1].Quantity; found[0].QuantityMini += found[1].QuantityMini; // then remove duplicate from list dayWPF.DailyBatches.RemoveAt(i); } } } return(dayWPF); } catch (Exception ex) { Log("GetDayInfo(string,bool) - Error msg:" + ex.Message); return(null); } }