public ActionResult Update(EmployeeTerritoryItemModel employeeTerritoryItemModel)
        {
            try
            {
                if (IsUpdate(employeeTerritoryItemModel.OperationResult))
                {
                    if (IsValid(employeeTerritoryItemModel.OperationResult, employeeTerritoryItemModel.EmployeeTerritory))
                    {
                        EmployeeTerritory employeeTerritory = (EmployeeTerritory)employeeTerritoryItemModel.EmployeeTerritory.ToData();
                        if (Application.Update(employeeTerritoryItemModel.OperationResult, employeeTerritory))
                        {
                            if (employeeTerritoryItemModel.IsSave)
                            {
                                return(JsonResultSuccess(employeeTerritoryItemModel.OperationResult,
                                                         Url.Action("Update", "EmployeeTerritory", new { EmployeeId = employeeTerritory.EmployeeId, TerritoryId = employeeTerritory.TerritoryId }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(employeeTerritoryItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                employeeTerritoryItemModel.OperationResult.ParseException(exception);
            }

            employeeTerritoryItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(employeeTerritoryItemModel.OperationResult));
        }
        public ActionResult Delete(int?employeeId, string territoryId, int?masterEmployeeId = null, string masterTerritoryId = null)
        {
            EmployeeTerritoryItemModel employeeTerritoryItemModel = new EmployeeTerritoryItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                EmployeeTerritory    = new EmployeeTerritoryViewModel(),
                ControllerAction     = "Delete",
                MasterEmployeeId     = masterEmployeeId, MasterTerritoryId = masterTerritoryId
            };

            try
            {
                EmployeeTerritoryDTO employeeTerritoryDTO = Application.GetById(employeeTerritoryItemModel.OperationResult, new object[] { employeeId, territoryId });
                if (employeeTerritoryDTO != null)
                {
                    employeeTerritoryItemModel.EmployeeTerritory = new EmployeeTerritoryViewModel(employeeTerritoryDTO);
                }
            }
            catch (Exception exception)
            {
                employeeTerritoryItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(employeeTerritoryItemModel));
        }
        public ActionResult Delete(EmployeeTerritoryItemModel employeeTerritoryItemModel)
        {
            try
            {
                if (Application.Delete(employeeTerritoryItemModel.OperationResult, (EmployeeTerritoryDTO)employeeTerritoryItemModel.EmployeeTerritory.ToDTO()))
                {
                    return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                }
            }
            catch (Exception exception)
            {
                employeeTerritoryItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(employeeTerritoryItemModel.OperationResult));
        }
        public ActionResult Create(string masterEntity = null, string masterKey = null)
        {
            EmployeeTerritoryItemModel employeeTerritoryItemModel = new EmployeeTerritoryItemModel(ActivityOperations, "Create", masterEntity, masterKey);

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

            return(JsonResultOperationResult(employeeTerritoryItemModel.OperationResult));
        }
        public ActionResult Delete(EmployeeTerritoryItemModel employeeTerritoryItemModel)
        {
            try
            {
                if (IsDelete(employeeTerritoryItemModel.OperationResult))
                {
                    if (Application.Delete(employeeTerritoryItemModel.OperationResult, (EmployeeTerritory)employeeTerritoryItemModel.EmployeeTerritory.ToData()))
                    {
                        return(JsonResultSuccess(employeeTerritoryItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                employeeTerritoryItemModel.OperationResult.ParseException(exception);
            }

            employeeTerritoryItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(employeeTerritoryItemModel.OperationResult));
        }
        public ActionResult Create(int?masterEmployeeId = null, string masterTerritoryId = null)
        {
            EmployeeTerritoryItemModel employeeTerritoryItemModel = new EmployeeTerritoryItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                EmployeeTerritory    = new EmployeeTerritoryViewModel(),
                ControllerAction     = "Create",
                MasterEmployeeId     = masterEmployeeId, MasterTerritoryId = masterTerritoryId
            };

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

            return(PartialView(employeeTerritoryItemModel));
        }
        public ActionResult Delete(int employeeId, string territoryId, string masterEntity = null, string masterKey = null)
        {
            EmployeeTerritoryItemModel employeeTerritoryItemModel = new EmployeeTerritoryItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(employeeTerritoryItemModel.OperationResult))
                {
                    EmployeeTerritory employeeTerritory = Application.GetById(employeeTerritoryItemModel.OperationResult, new object[] { employeeId, territoryId });
                    if (employeeTerritory != null)
                    {
                        employeeTerritoryItemModel.EmployeeTerritory = new EmployeeTerritoryViewModel(employeeTerritory);

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

            return(JsonResultOperationResult(employeeTerritoryItemModel.OperationResult));
        }