public OrderStatus StopOrder(Order order) { DataAccess.Orders stopOrder = new DataAccess.Orders(); if (order.StartDate is null) { return(OrderStatus.Stop_Before_Start); } order.FinishDate = DateTime.UtcNow; order.StartDate = order.StartDate.Value.ToUniversalTime(); stopOrder.Modify(order); return(OrderStatus.Succes); }
/// <summary> /// Modify only the specified properties of the Order /// specified by: /// </summary> /// <param name="id">PK</param> /// <param name="propValues">Properties to change</param> public virtual void Modify(Int32 id, params KeyValuePair <string, object>[] propValues) { try { Trace.WriteInformation("({0}, {1})", Trace.GetMethodName(), CLASSNAME, id, string.Join(",", propValues)); DataAccess.Orders orders = new DataAccess.Orders(); orders.Modify( id, propValues); return; } catch (Exception ex) { Trace.WriteError("({0})", Trace.GetMethodName(), CLASSNAME, ex, id); throw; } }
public OrderStatus StartOrder(Order orderToStart) { DataAccess.Orders orders = new DataAccess.Orders(); List <Model.Order> actualOrdersResult = orders.GetAllActual(); foreach (Model.Order actualOrder in actualOrdersResult) { if (actualOrder.StartDate != null && actualOrder.ResourceId == orderToStart.ResourceId) { return(OrderStatus.Resource_in_use); } } orderToStart.StartDate = DateTime.UtcNow; orders.Modify(orderToStart); return(OrderStatus.Succes); }
/// <summary> /// Modify the given Order in the database /// </summary> public virtual void Modify(Model.Order modifiedOrder) { try { Trace.WriteInformation("({0})", Trace.GetMethodName(), CLASSNAME, modifiedOrder); //Begin Checks CheckConstraints(modifiedOrder); if (!Exists(modifiedOrder)) { throw new BusinessException(string.Format("There is no Order with this id. ({0})", modifiedOrder)); } DataAccess.Orders orders = new DataAccess.Orders(); orders.Modify(modifiedOrder); } catch (Exception ex) { Trace.WriteError("({0})", Trace.GetMethodName(), CLASSNAME, ex, modifiedOrder); throw; } }