Пример #1
0
        public void Creat_Loan()
        {
            var context     = new ValiasrContext("Valiasr");
            var loanRequest = context.LoanRequests.Where(a => a.ReqNo == 1).FirstOrDefault();
            var account     = context.BankAccounts.Where(a => a.Code == "1/0/0").FirstOrDefault();

            //var loan = new Loan { Id = Guid.NewGuid(), Amount = 2000 ,LoanRequest = loanRequest,Account = account};
            //loanRequest.Loan = loan;
            // context.LoanRequests.Add(loanRequest);
            //account.Loan = loan;
            context.SaveChanges();
        }
Пример #2
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();*/
        }
Пример #3
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();*/
        }