예제 #1
0
        public ActionResult Update(TerritoryItemModel territoryItemModel)
        {
            try
            {
                if (IsUpdate(territoryItemModel.OperationResult))
                {
                    if (IsValid(territoryItemModel.OperationResult, territoryItemModel.Territory))
                    {
                        Territory territory = (Territory)territoryItemModel.Territory.ToData();
                        if (Application.Update(territoryItemModel.OperationResult, territory))
                        {
                            if (territoryItemModel.IsSave)
                            {
                                return(JsonResultSuccess(territoryItemModel.OperationResult,
                                                         Url.Action("Update", "Territory", new { TerritoryId = territory.TerritoryId }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(territoryItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                territoryItemModel.OperationResult.ParseException(exception);
            }

            territoryItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(territoryItemModel.OperationResult));
        }
예제 #2
0
        public ActionResult Delete(string territoryId, int?masterRegionId = null)
        {
            TerritoryItemModel territoryItemModel = new TerritoryItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Territory            = new TerritoryViewModel(),
                ControllerAction     = "Delete",
                MasterRegionId       = masterRegionId
            };

            try
            {
                TerritoryDTO territoryDTO = Application.GetById(territoryItemModel.OperationResult, new object[] { territoryId });
                if (territoryDTO != null)
                {
                    territoryItemModel.Territory = new TerritoryViewModel(territoryDTO);
                }
            }
            catch (Exception exception)
            {
                territoryItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(territoryItemModel));
        }
예제 #3
0
        public ActionResult Delete(TerritoryItemModel territoryItemModel)
        {
            try
            {
                if (Application.Delete(territoryItemModel.OperationResult, (TerritoryDTO)territoryItemModel.Territory.ToDTO()))
                {
                    return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                }
            }
            catch (Exception exception)
            {
                territoryItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(territoryItemModel.OperationResult));
        }
예제 #4
0
        public ActionResult Create(string masterEntity = null, string masterKey = null)
        {
            TerritoryItemModel territoryItemModel = new TerritoryItemModel(ActivityOperations, "Create", masterEntity, masterKey);

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

            return(JsonResultOperationResult(territoryItemModel.OperationResult));
        }
예제 #5
0
        public ActionResult Delete(TerritoryItemModel territoryItemModel)
        {
            try
            {
                if (IsDelete(territoryItemModel.OperationResult))
                {
                    if (Application.Delete(territoryItemModel.OperationResult, (Territory)territoryItemModel.Territory.ToData()))
                    {
                        return(JsonResultSuccess(territoryItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                territoryItemModel.OperationResult.ParseException(exception);
            }

            territoryItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(territoryItemModel.OperationResult));
        }
예제 #6
0
        public ActionResult Create(int?masterRegionId = null)
        {
            TerritoryItemModel territoryItemModel = new TerritoryItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Territory            = new TerritoryViewModel(),
                ControllerAction     = "Create",
                MasterRegionId       = masterRegionId
            };

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

            return(PartialView(territoryItemModel));
        }
예제 #7
0
        public ActionResult Delete(string territoryId, string masterEntity = null, string masterKey = null)
        {
            TerritoryItemModel territoryItemModel = new TerritoryItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(territoryItemModel.OperationResult))
                {
                    Territory territory = Application.GetById(territoryItemModel.OperationResult, new object[] { territoryId });
                    if (territory != null)
                    {
                        territoryItemModel.Territory = new TerritoryViewModel(territory);

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

            return(JsonResultOperationResult(territoryItemModel.OperationResult));
        }