Beispiel #1
0
        public ActionResult Update(OrderItemModel orderItemModel)
        {
            try
            {
                if (IsUpdate(orderItemModel.OperationResult))
                {
                    if (IsValid(orderItemModel.OperationResult, orderItemModel.Order))
                    {
                        Order order = (Order)orderItemModel.Order.ToData();
                        if (Application.Update(orderItemModel.OperationResult, order))
                        {
                            if (orderItemModel.IsSave)
                            {
                                return(JsonResultSuccess(orderItemModel.OperationResult,
                                                         Url.Action("Update", "Order", new { OrderId = order.OrderId }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(orderItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                orderItemModel.OperationResult.ParseException(exception);
            }

            orderItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(orderItemModel.OperationResult));
        }
        public ActionResult Delete(int?orderId, string masterCustomerId = null, int?masterEmployeeId = null, int?masterShipVia = null)
        {
            OrderItemModel orderItemModel = new OrderItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Order            = new OrderViewModel(),
                ControllerAction = "Delete",
                MasterCustomerId = masterCustomerId, MasterEmployeeId = masterEmployeeId, MasterShipVia = masterShipVia
            };

            try
            {
                OrderDTO orderDTO = Application.GetById(orderItemModel.OperationResult, new object[] { orderId });
                if (orderDTO != null)
                {
                    orderItemModel.Order = new OrderViewModel(orderDTO);
                }
            }
            catch (Exception exception)
            {
                orderItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(orderItemModel));
        }
        public ActionResult Delete(OrderItemModel orderItemModel)
        {
            try
            {
                if (Application.Delete(orderItemModel.OperationResult, (OrderDTO)orderItemModel.Order.ToDTO()))
                {
                    return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                }
            }
            catch (Exception exception)
            {
                orderItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(orderItemModel.OperationResult));
        }
Beispiel #4
0
        public ActionResult Create(string masterEntity = null, string masterKey = null)
        {
            OrderItemModel orderItemModel = new OrderItemModel(ActivityOperations, "Create", masterEntity, masterKey);

            try
            {
                if (IsCreate(orderItemModel.OperationResult))
                {
                    return(ZPartialView("CRUD", orderItemModel));
                }
            }
            catch (Exception exception)
            {
                orderItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(orderItemModel.OperationResult));
        }
        public ActionResult Update(OrderItemModel orderItemModel)
        {
            try
            {
                if (ValidateModelState(Application.Repository))
                {
                    if (Application.Update(orderItemModel.OperationResult, (OrderDTO)orderItemModel.Order.ToDTO()))
                    {
                        return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                    }
                }
            }
            catch (Exception exception)
            {
                orderItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(orderItemModel.OperationResult));
        }
Beispiel #6
0
        public ActionResult Delete(OrderItemModel orderItemModel)
        {
            try
            {
                if (IsDelete(orderItemModel.OperationResult))
                {
                    if (Application.Delete(orderItemModel.OperationResult, (Order)orderItemModel.Order.ToData()))
                    {
                        return(JsonResultSuccess(orderItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                orderItemModel.OperationResult.ParseException(exception);
            }

            orderItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(orderItemModel.OperationResult));
        }
        public ActionResult Create(string masterCustomerId = null, int?masterEmployeeId = null, int?masterShipVia = null)
        {
            OrderItemModel orderItemModel = new OrderItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Order            = new OrderViewModel(),
                ControllerAction = "Create",
                MasterCustomerId = masterCustomerId, MasterEmployeeId = masterEmployeeId, MasterShipVia = masterShipVia
            };

            try
            {
                IsCreate(orderItemModel.OperationResult);
            }
            catch (Exception exception)
            {
                orderItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(orderItemModel));
        }
Beispiel #8
0
        public ActionResult Delete(int orderId, string masterEntity = null, string masterKey = null)
        {
            OrderItemModel orderItemModel = new OrderItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(orderItemModel.OperationResult))
                {
                    Order order = Application.GetById(orderItemModel.OperationResult, new object[] { orderId });
                    if (order != null)
                    {
                        orderItemModel.Order = new OrderViewModel(order);

                        return(ZPartialView("CRUD", orderItemModel));
                    }
                }
            }
            catch (Exception exception)
            {
                orderItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(orderItemModel.OperationResult));
        }