public string RemoveGeneralAccount(Guid id)
 {
     try
     {
         GeneralAccountRepository repository     = new GeneralAccountRepository();
         GeneralAccount           generalAccount =
             repository.ActiveContext.GeneralAccounts.Include("IndexAccounts")
             .Where(ga => ga.Id == id)
             .FirstOrDefault();
         if (generalAccount == null)
         {
             return("no record was found by this id");
         }
         if (generalAccount.ContainIndexAccounts)
         {
             return("this record has index account record and can not be deleted");
         }
         repository.Remove(generalAccount);
         return("has successfully removed");
     }
     catch (Exception exception)
     {
         return(exception.Message);
     }
 }
示例#2
0
        public void create_generalAccount()
        {
            GeneralAccount           generalAccount = CreateGeneralAccount();
            GeneralAccountRepository repository     = new GeneralAccountRepository();

            repository.Add(generalAccount);
        }
        public ActionResult GetDynamicGeneralAccountCode(int GeneralAccountID)
        {
            FM_Bank        model     = new FM_Bank();
            GeneralAccount tblSector = (from e in TOSSDB.GeneralAccounts where e.GeneralAccountID == GeneralAccountID select e).FirstOrDefault();

            model.BankAccountGeneralAccountCodeID = tblSector.SubMajorAccountGroup.MajorAccountGroup.AccountGroup.AccountGroupCode + "- " + tblSector.SubMajorAccountGroup.MajorAccountGroup.MajorAccountGroupCode + "- " + tblSector.SubMajorAccountGroup.SubMajorAccountGroupCode + "- " + tblSector.GeneralAccountCode;
            return(PartialView("BankAccount/_DynamicDDGeneralCode", model));
        }
示例#4
0
        public static GeneralAccount CreateGeneralAccount()
        {
            var generalAccount = new GeneralAccount {
                Id = Guid.NewGuid(), Description = "sandogh", Category = 1, Code = 1
            };

            return(generalAccount);
        }
        public GeneralAccountDto GetGeneralAccount(int code)
        {
            GeneralAccountRepository repository = new GeneralAccountRepository();
            GeneralAccount           general    = repository.ActiveContext.GeneralAccounts
                                                  .Where(ga => ga != null && ga.Code == code)
                                                  .FirstOrDefault();

            return(general != null
                       ? (GeneralAccountDto) new GeneralAccountDto().InjectFrom <UnflatLoopValueInjection>(general)
                       : null);
        }
示例#6
0
        public void Create_Complex_Account()
        {
            var            context        = new ValiasrContext("Valiasr");
            Person         person         = PersonTest.CreatePerson();
            Customer       customer       = PersonTest.CreateCustomer(person);
            Lawyer         lawyer         = PersonTest.CreateLawyer(person);
            IndexAccount   indexAccount   = CreateIndexAccount();
            GeneralAccount generalAccount = CreateGeneralAccount();
            Account        account        = CreateAccount();

            account.Lawyers = new Collection <Lawyer>();
            account.Lawyers.Add(lawyer);
            account.Customers = new Collection <Customer>();
            account.Customers.Add(customer);
            LoanRequest loanRequest = new LoanRequest();
            Loan        loan        = new Loan();

            //        loan.Account = account;
            loan.LoanRequest = loanRequest;
            LoanRequestOkyAssistant loanRequestOkyAssistant = new LoanRequestOkyAssistant();

            loanRequest.LoanRequestOkyAsistant = loanRequestOkyAssistant;
            loanRequest.Account  = account;
            account.LoanRequests = new Collection <LoanRequest>();
            account.LoanRequests.Add(loanRequest);
            indexAccount.BankAccounts = new Collection <BankAccount>();
            indexAccount.BankAccounts.Add(account);
            indexAccount.BankAccounts.Add(loan);
            generalAccount.IndexAccounts = new Collection <IndexAccount>();
            generalAccount.IndexAccounts.Add(indexAccount);
            context.GeneralAccounts.Add(generalAccount);
            //context.IndexAccounts.Add(indexAccount);

            context.SaveChanges();

            /* GeneralAccount generalAccount = CreateGeneralAccount();
             *
             *
             *
             * account.Lawyers.Add(lawyer);
             * indexAccount.Accounts.Add(account);
             * generalAccount.IndexAccounts.Add(indexAccount);
             *
             * context.GeneralAccounts.Add(generalAccount);
             * account.Customers.Add(customer);
             * context.SaveChanges();*/
        }
        /// <summary>
        /// Method to create a new account.
        /// </summary>
        /// <param name="accountNumber">The account number.</param>
        /// <param name="customerId">The customer identifier.</param>
        /// <param name="currencyCode">The currency code.</param>
        /// <param name="initialBalance">The initial balance.</param>
        /// <param name="mimimumBalance">The mimimum balance.</param>
        public void CreateGeneralAccount(string accountNumber, string customerId, string currencyCode, decimal?initialBalance, decimal?mimimumBalance)
        {
            try
            {
                if (Repository.GeneralAccountRepository.Any(a => string.Equals(a.AccountNumber, accountNumber, StringComparison.CurrentCultureIgnoreCase)))
                {
                    throw new DataException($"Unable to create account as account number {accountNumber} already exist !!");
                }
                if (initialBalance == null)
                {
                    throw new DataException("Unable to create account as provided initial balance is unknown !!");
                }
                if (mimimumBalance == null)
                {
                    throw new DataException("Unable to create account as provided minimum balance is unknown !!");
                }

                ICustomer accountHolder = Repository.CustomerRepository.FirstOrDefault(c => string.Equals(c.CustomerId, customerId, StringComparison.CurrentCultureIgnoreCase));
                if (accountHolder == null)
                {
                    throw new DataException($"Unable to create account for customer id {customerId} as customer not found !!");
                }

                Currency defaultCurrency = Repository.CurrencyRepository.FirstOrDefault(c =>
                                                                                        string.Equals(c.Code, currencyCode, StringComparison.CurrentCultureIgnoreCase));
                if (defaultCurrency == null)
                {
                    throw new DataException($"Unable to create account for customer as provided currency code {currencyCode} doesn't exist !!");
                }

                IGeneralAccount account = new GeneralAccount(accountNumber, accountHolder, defaultCurrency, initialBalance.Value, mimimumBalance.Value);
                Repository.GeneralAccountRepository.Add(account);
            }
            catch (DataException dataException)
            {
                Console.WriteLine($"ERROR - {dataException.Message}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"An error occured while creating account !! {ex.Message}");
            }
        }
        /// <summary>
        /// accout region
        /// </summary>
        /// <param name="generalAccountDto"></param>

        public string AddGeneralAccount(GeneralAccountDto generalAccountDto)
        {
            try
            {
                int code = generalAccountDto.Code;
                GeneralAccountRepository repository = new GeneralAccountRepository();
                if ((repository.ActiveContext.GeneralAccounts.Count(ga => ga.Code == code)) == 0)
                {
                    GeneralAccount generalAccount = new GeneralAccount();
                    generalAccountDto.Id = Guid.NewGuid();
                    generalAccount.InjectFrom <UnflatLoopValueInjection>(generalAccountDto);
                    repository.Add(generalAccount);
                    return("has successfully created");
                }
                return("this record with this code is there");
            }
            catch (Exception exception)
            {
                return(exception.Message);
            }
        }
 /// <summary>
 /// accout region
 /// </summary>
 /// <param name="generalAccountDto"></param>
 public string AddGeneralAccount(GeneralAccountDto generalAccountDto)
 {
     try
     {
         int code = generalAccountDto.Code;
         GeneralAccountRepository repository = new GeneralAccountRepository();
         if ((repository.ActiveContext.GeneralAccounts.Count(ga => ga.Code == code)) == 0)
         {
             GeneralAccount generalAccount = new GeneralAccount();
             generalAccountDto.Id = Guid.NewGuid();
             generalAccount.InjectFrom<UnflatLoopValueInjection>(generalAccountDto);
             repository.Add(generalAccount);
             return "has successfully created";
         }
         return "this record with this code is there";
     }
     catch (Exception exception)
     {
         return exception.Message;
     }
 }
示例#10
0
        public void Create_Complex_Account1()
        {
            GeneralAccountRepository context = new GeneralAccountRepository();
            Person person = PersonTest.CreatePerson();
            //           Customer customer = PersonTest.CreateCustomer(person);
            Lawyer         lawyer         = PersonTest.CreateLawyer(person);
            GeneralAccount generalAccount = CreateGeneralAccount();
            IndexAccount   indexAccount   = CreateIndexAccount();
            Account        account        = CreateAccount();

//            account.Customers.Add(customer);
            account.Lawyers.Add(lawyer);
            indexAccount.BankAccounts.Add(account);
            generalAccount.IndexAccounts.Add(indexAccount);
            context.Add(generalAccount);

            //context.AddIndexAccount(indexAccount);
            //context.GeneralAccounts.Add(generalAccount);

            // context.SaveChanges();
        }
示例#11
0
        public static void ComputerFinanicalStatemments(DataStore dataStore)
        {
            var input             = dataStore.GetPackage(WorkFlowViewModel.InputParametersPackageDefinition);
            var journalStatements = dataStore.GetPackage(WorkFlowViewModel.InputJournalStatementsPackageDefintion);
            var previousBalanceSheetStatements =
                dataStore.GetPackage(WorkFlowViewModel.PreviousBalanceSheetStatementsPackageDefinition);
            var accountDefinitionStatement =
                dataStore.GetPackage(WorkFlowViewModel.InputAccountDefinitionPackageDefinition);

            var accountPrintableNamesLookup =
                dataStore.GetPackage(WorkFlowViewModel.DisplayableAccountNamesDictionaryPackageDefinition);

            GeneralAccount generalAccount = new GeneralAccount(input.AccountingPeriodStartDate, input.AccountingPeriodEndDate,
                                                               previousBalanceSheetStatements, journalStatements, accountDefinitionStatement, accountPrintableNamesLookup);


            dataStore.PutPackage(generalAccount.GetAllAccounts(), WorkFlowViewModel.AccountsPackageDefinition);
            dataStore.PutPackage(generalAccount.GetTrialBalanceStatements(),
                                 WorkFlowViewModel.TrialBalanceStatementsPackageDefinition);
            dataStore.PutPackage(generalAccount.GetBalanceSheetStatements(),
                                 WorkFlowViewModel.BalanceSheetStatementsPackageDefinition);
        }
示例#12
0
 public string AddIndexAccount(IndexAccountDto indexAccountDto)
 {
     try
     {
         IndexAccountRepository repository     = new IndexAccountRepository();
         GeneralAccount         generalAccount =
             repository.ActiveContext.GeneralAccounts.Include("IndexAccounts")
             .FirstOrDefault(ga => ga.Id == indexAccountDto.GeneralAccountId);
         if (!generalAccount.ContainIndexAccount(code: indexAccountDto.Code))
         {
             IndexAccount indexAccount = new IndexAccount();
             indexAccountDto.Id = Guid.NewGuid();
             indexAccount.InjectFrom <UnflatLoopValueInjection>(indexAccountDto);
             indexAccount.GeneralAccount = generalAccount;
             repository.Add(indexAccount);
             return("has successfully created");
         }
         return("this record with this code was there in database");
     }
     catch (Exception exception)
     {
         return(exception.Message);
     }
 }
示例#13
0
 public static GeneralAccount CreateGeneralAccount()
 {
     var generalAccount = new GeneralAccount { Id = Guid.NewGuid(),Description = "sandogh", Category = 1,Code = 1};
     return generalAccount;
 }
 public FM_ChartOfAccounts_GeneralAccount()
 {
     getGeneralAccount        = new List <GeneralAccount>();
     getGeneralAccountcolumns = new GeneralAccount();
     getGeneralAccountList    = new List <GeneralAccountList>();
 }