Example #1
0
 public int ChangeOrderStatus(OrderForChangeStatus order)
 {
     var orderEdit = _context.Orders.Get(order.Id);
     if (orderEdit != null)
     {
         if (orderEdit.Status == OrderStatus.Выполнено.ToString() && order.Status != OrderStatus.Выполнено.ToString())
         {
             orderEdit.Status = order.Status;
             orderEdit.ActualEndDate = null;
         }
         else if (orderEdit.Status != OrderStatus.Выполнено.ToString())
         {
             orderEdit.Status = order.Status;
             if (order.ActualDateEnd != null && order.ActualTimeEnd != null)
             {
                 DateTime actualDateEnd = order.ActualDateEnd.Value;
                 TimeSpan actualTimeEnd = order.ActualTimeEnd.Value;
                 orderEdit.ActualEndDate = actualDateEnd.Add(actualTimeEnd);
             }
         }
         int result = _context.Save();
         return result;
     }
     return 0;
 }
Example #2
0
 public ActionResult ChangeStatus(int id, string status, DateTime? ActualDateEnd, TimeSpan? ActualTimeEnd)
 {
     if (Request.IsAjaxRequest())
     {
         OrderForChangeStatus order = new OrderForChangeStatus
         {
             Id = id,
             Status = status,
             ActualDateEnd = ActualDateEnd,
             ActualTimeEnd = ActualTimeEnd,
         };
         int result = AdminService.ChangeOrderStatus(order);
         if (result >= 0)
         {
             OrderForReport resutOrder = new OrderForReport
             {
                 Id = id,
                 Status = status,
             };
             return PartialView("PartialReports", resutOrder);
         }
     }
     return View("Error");
 }