Example #1
0
 private void DeleteChocolateFromList(OrderContentChocolate p)
 {
     OrderContentChocolates.Remove(p);
     if (deletedOrderContentChocolates == null)
     {
         deletedOrderContentChocolates = new List <OrderContentChocolate>();
     }
     deletedOrderContentChocolates.Add(p);
 }
Example #2
0
        public bool UpdateOcHasChoco(OrderContentChocolate ocChoco)
        {
            var temp = localDb.OrderContent_has_Chocolate.Where(p => p.OrderContent_ID.Equals(ocChoco.OrderContentId)).Select(p => p).First();;

            temp.OrderContent_ID = ocChoco.OrderContentId;
            temp.Chocolate_ID    = ocChoco.Chocolate.ChocolateId;
            temp.ModifyDate      = DateTime.Now;

            return(localDb.SaveChanges() == 1);
        }
Example #3
0
 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()));
 }
Example #4
0
        public bool InsertOcHasChoco(OrderContentChocolate ocChoco)
        {
            localDb.OrderContent_has_Chocolate.Add(converter.ConvertToDBOcHasChoco(ocChoco, ocChoco.Chocolate));

            return(localDb.SaveChanges() == 1);
        }
Example #5
0
 private void ShowChocolateDetails(OrderContentChocolate p)
 {
     Messenger.Default.Send(p.Chocolate);
     CurrentDetail = SimpleIoc.Default.GetInstance <CreationDetailsVm>();
     RaisePropertyChanged("CurrentDetail");
 }