예제 #1
0
        public ActionResult Edit(string id)
        {
            AccountCreateViewModel model = AccountHelper.GetAccount(id);

            List <AccountValueViewModel> accountValues = AccountValueHelper.GetAccountValuesbyChartId(Convert.ToInt64(id), SessionHelper.SOBId);

            if (accountValues.Any())
            {
                throw new Exception("Edit Error", new Exception {
                    Source = "Accounts having values cannot be edited"
                });
            }

            List <Core.Entities.CodeCombinition> codeCombinitions = CodeCombinationHelper.GetCodeCombinations(model.SOBId, AuthenticationHelper.CompanyId.Value);

            if (codeCombinitions.Any())
            {
                throw new Exception("Edit Error", new Exception {
                    Source = "Accounts having code combinitions cannot be edited"
                });
            }

            model.SOBId = SessionHelper.SOBId;
            return(View(model));
        }
예제 #2
0
        public ActionResult Delete(string id)
        {
            List <AccountValueViewModel> accountValues = AccountValueHelper.GetAccountValuesbyChartId(Convert.ToInt64(id), SessionHelper.SOBId);

            if (accountValues.Any())
            {
                throw new Exception("Delete Error", new Exception {
                    Source = "Accounts having values cannot be deleted"
                });
            }

            List <Core.Entities.CodeCombinition> codeCombinitions = CodeCombinationHelper.GetCodeCombinations(SessionHelper.SOBId, AuthenticationHelper.CompanyId.Value);

            if (codeCombinitions.Any())
            {
                throw new Exception("Delete Error", new Exception {
                    Source = "Accounts having code combinitions cannot be edited"
                });
            }

            AccountHelper.Delete(id);
            return(RedirectToAction("Index"));
        }