Esempio n. 1
0
        public ActionResult Update(OrderDetailItemModel orderDetailItemModel)
        {
            try
            {
                if (IsUpdate(orderDetailItemModel.OperationResult))
                {
                    if (IsValid(orderDetailItemModel.OperationResult, orderDetailItemModel.OrderDetail))
                    {
                        OrderDetail orderDetail = (OrderDetail)orderDetailItemModel.OrderDetail.ToData();
                        if (Application.Update(orderDetailItemModel.OperationResult, orderDetail))
                        {
                            if (orderDetailItemModel.IsSave)
                            {
                                return(JsonResultSuccess(orderDetailItemModel.OperationResult,
                                                         Url.Action("Update", "OrderDetail", new { OrderId = orderDetail.OrderId, ProductId = orderDetail.ProductId }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(orderDetailItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                orderDetailItemModel.OperationResult.ParseException(exception);
            }

            orderDetailItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(orderDetailItemModel.OperationResult));
        }
        public ActionResult Delete(int?orderId, int?productId, int?masterOrderId = null, int?masterProductId = null)
        {
            OrderDetailItemModel orderDetailItemModel = new OrderDetailItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                OrderDetail          = new OrderDetailViewModel(),
                ControllerAction     = "Delete",
                MasterOrderId        = masterOrderId, MasterProductId = masterProductId
            };

            try
            {
                OrderDetailDTO orderDetailDTO = Application.GetById(orderDetailItemModel.OperationResult, new object[] { orderId, productId });
                if (orderDetailDTO != null)
                {
                    orderDetailItemModel.OrderDetail = new OrderDetailViewModel(orderDetailDTO);
                }
            }
            catch (Exception exception)
            {
                orderDetailItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(orderDetailItemModel));
        }
        public ActionResult Delete(OrderDetailItemModel orderDetailItemModel)
        {
            try
            {
                if (Application.Delete(orderDetailItemModel.OperationResult, (OrderDetailDTO)orderDetailItemModel.OrderDetail.ToDTO()))
                {
                    return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                }
            }
            catch (Exception exception)
            {
                orderDetailItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(orderDetailItemModel.OperationResult));
        }
Esempio n. 4
0
        public ActionResult Create(string masterEntity = null, string masterKey = null)
        {
            OrderDetailItemModel orderDetailItemModel = new OrderDetailItemModel(ActivityOperations, "Create", masterEntity, masterKey);

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

            return(JsonResultOperationResult(orderDetailItemModel.OperationResult));
        }
        public ActionResult Create(OrderDetailItemModel orderDetailItemModel)
        {
            try
            {
                if (ValidateModelState(Application.Repository))
                {
                    if (Application.Create(orderDetailItemModel.OperationResult, (OrderDetailDTO)orderDetailItemModel.OrderDetail.ToDTO()))
                    {
                        return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                    }
                }
            }
            catch (Exception exception)
            {
                orderDetailItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(orderDetailItemModel.OperationResult));
        }
Esempio n. 6
0
        public ActionResult Delete(OrderDetailItemModel orderDetailItemModel)
        {
            try
            {
                if (IsDelete(orderDetailItemModel.OperationResult))
                {
                    if (Application.Delete(orderDetailItemModel.OperationResult, (OrderDetail)orderDetailItemModel.OrderDetail.ToData()))
                    {
                        return(JsonResultSuccess(orderDetailItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                orderDetailItemModel.OperationResult.ParseException(exception);
            }

            orderDetailItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(orderDetailItemModel.OperationResult));
        }
        public ActionResult Create(int?masterOrderId = null, int?masterProductId = null)
        {
            OrderDetailItemModel orderDetailItemModel = new OrderDetailItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                OrderDetail          = new OrderDetailViewModel(),
                ControllerAction     = "Create",
                MasterOrderId        = masterOrderId, MasterProductId = masterProductId
            };

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

            return(PartialView(orderDetailItemModel));
        }
Esempio n. 8
0
        public ActionResult Delete(int orderId, int productId, string masterEntity = null, string masterKey = null)
        {
            OrderDetailItemModel orderDetailItemModel = new OrderDetailItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(orderDetailItemModel.OperationResult))
                {
                    OrderDetail orderDetail = Application.GetById(orderDetailItemModel.OperationResult, new object[] { orderId, productId });
                    if (orderDetail != null)
                    {
                        orderDetailItemModel.OrderDetail = new OrderDetailViewModel(orderDetail);

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

            return(JsonResultOperationResult(orderDetailItemModel.OperationResult));
        }