Example #1
0
 public void UpdateOrder(BO.Order order)
 {
     DO.Order dalOrder = new DO.Order();
     try
     {
         dalOrder = dal.RecieveOrder(order.Key);
     }
     catch (MissingMemberException e)
     {
         throw e;
     }
     if (!AbleToChangeOrderStatus(order))
     {
         throw new InvalidOperationException("You can't change a order status after other placed/ alradey irrelevant");
     }
     else
     {
         //check if order placed now
         if (IsOpenOrder(Conversions.CastingToBO_Order(dalOrder)))
         {
             if (order.Status == BO.Order_Status.EMAIL_SENT && dalOrder.Status != DO.Order_Status.EMAIL_SENT)
             {
                 SendEmail(order);
             }
             if (order.Status == BO.Order_Status.APPROVED)
             {
                 PlaceOrder(order);
                 order.CloseDate = DateTime.Now;
             }
         }
     }
     dal.UpdateOrder(Conversions.CastingToDO_Order(order));
 }
Example #2
0
 public bool AbleToChangeOrderStatus(BO.Order order)//
 {
     DO.Order dOrder = dal.RecieveOrder(order.Key);
     return(dOrder.Status != DO.Order_Status.APPROVED && dOrder.Status != DO.Order_Status.IRRELEVANT);
 }
Example #3
0
 public bool IsOpenOrder(BO.Order bOrder)
 {
     DO.Order order = dal.RecieveOrder(bOrder.Key);
     return(order.Status != DO.Order_Status.CLIENT_CLOSED && order.Status != DO.Order_Status.IGNORED_CLOSED && order.Status != DO.Order_Status.IRRELEVANT);
 }
Example #4
0
 public Order RecieveOrder(int key)
 {
     DO.Order order = XML.RecieveOrder(key);
     return(order == null ? throw new MissingMemberException($"Order {key} dosen't Exist") : order);
 }