private void DeletePackageFromList(OrderContentPackage p) { OrderContentPackages.Remove(p); if (deletedOrderContentPackages == null) { deletedOrderContentPackages = new List <OrderContentPackage>(); } deletedOrderContentPackages.Add(p); }
public bool UpdateOcHasPackage(OrderContentPackage ocPackage) { var temp = localDb.OrderContent_has_Package.Where(p => p.OrderContent_ID.Equals(ocPackage.OrderContentId)).Select(p => p).First();; temp.OrderContent_ID = ocPackage.OrderContentId; temp.Package_ID = ocPackage.Package.PackageId; temp.ModifyDate = DateTime.Now; return(localDb.SaveChanges() == 1); }
private void IngredientDeactivated(IngredientDeactivatedMessage ing) { foreach (var order in OrdersList) { foreach (var orderContent in order.Content) { if (orderContent is OrderContentChocolate) { OrderContentChocolate occ = (OrderContentChocolate)orderContent; occ.Chocolate.Ingredients = DataAgentUnit.GetInstance().QueryIngredientsByChocolateId(occ.Chocolate.ChocolateId).ToList(); foreach (var item in occ.Chocolate.Ingredients) { if (item.IngredientId == ing.DeactivatedIngredient.IngredientId) { order.Status.OrderStatusId = new Guid("e9ea67d5-bee2-4372-9abb-408a2afe3640"); DataAgentUnit.GetInstance().UpdateOrder(order); RaisePropertyChanged("OrderList"); Messenger.Default.Send("Orders have been paused because " + item.Name + " was deactivated. Check the orders view to take action."); } } } else { OrderContentPackage ocp = (OrderContentPackage)orderContent; foreach (var choco in ocp.Package.Chocolates) { choco.Ingredients = DataAgentUnit.GetInstance().QueryIngredientsByChocolateId(choco.ChocolateId).ToList(); foreach (var item in choco.Ingredients) { if (item.IngredientId == ing.DeactivatedIngredient.IngredientId) { order.Status.OrderStatusId = new Guid("e9ea67d5-bee2-4372-9abb-408a2afe3640"); DataAgentUnit.GetInstance().UpdateOrder(order); RaisePropertyChanged("OrderList"); Messenger.Default.Send("Orders have been paused because " + item.Name + " was deactivated. Check the orders view to take action."); } } } } } } Refresh(new RefreshMessage(GetType())); }
//public void UpdateChocoById(Guid chocolateId) //{ // throw new NotImplementedException(); //} #endregion #region INSERT METHODS public bool InsertOcHasPackage(OrderContentPackage ocPackage) { localDb.OrderContent_has_Package.Add(converter.ConvertToDBOcHasPackage(ocPackage, ocPackage.Package)); return(localDb.SaveChanges() == 1); }
private void ShowPackageDetails(OrderContentPackage p) { Messenger.Default.Send(p.Package); CurrentDetail = SimpleIoc.Default.GetInstance <PackageDetailsVm>(); RaisePropertyChanged("CurrentDetail"); }