Example #1
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();*/
        }
 public string AddLoanRequest(LoanRequestDto loanRequestDto)
 {
     try
     {
         LoanRequestRepository repository = new LoanRequestRepository();
         loanRequestDto.ReqNo = MakeReqNo(repository, loanRequestDto.Date);
         LoanRequest loanRequest = new LoanRequest();
         loanRequest.LoanRequestOkyAsistant = new LoanRequestOkyAssistant();
         Account account =
             repository.ActiveContext.BankAccounts.OfType<Account>()
                       .FirstOrDefault(a => a.Code == loanRequestDto.AccountCode);
         loanRequestDto.Id = Guid.NewGuid();
         loanRequest.InjectFrom<UnflatLoopValueInjection>(loanRequestDto);
         loanRequest.Account = account;
         repository.Add(loanRequest);
         return "request added successfully";
     }
     catch (Exception exception)
     {
         return exception.Message;
     }
 }
 private void TranslateLoanRequestOkyDto(LoanRequestOkyDto loanRequestOkyDto, LoanRequest loanRequest)
 {
     loanRequest.LoanRequestOkyAsistant.OKyDate = loanRequestOkyDto.OKyDate;
     loanRequest.LoanRequestOkyAsistant.OkyAss = loanRequestOkyDto.OkyAss;
     loanRequest.LoanRequestOkyAsistant.OkyQty = loanRequestOkyDto.OkyQty;
     loanRequest.LoanRequestOkyAsistant.PaymentCount = loanRequestOkyDto.PaymentCount;
     loanRequest.LoanRequestOkyAsistant.OkyDuration = loanRequestOkyDto.OkyDuration;
     loanRequest.LoanRequestOkyAsistant.OkyDurationType = loanRequestOkyDto.OkyDurationType;
     loanRequest.LoanRequestOkyAsistant.RegPerId = loanRequestOkyDto.RegPerId;
 }
Example #4
0
 public LoanRequest Create_Request(Account account)
 {
     var LoanRequest = new LoanRequest
     {
         Id = Guid.NewGuid(),
         Account = account,
         Amount = 5000,
         ReqNo = 1,
         Description = "h",
         Duration = 20,
         DurationType = "kl",
         FingerRegId = 4,
         LastDate = 13921024,
     };
     LoanRequestOkyAssistant loanRequestOkyAsistant = new LoanRequestOkyAssistant();
     LoanRequest.LoanRequestOkyAsistant = loanRequestOkyAsistant;
     return LoanRequest;
 }