예제 #1
0
        public PagedList <IndexAccount> GetPagingByModifier_V2(int pageIndex, int pageSize, int accountModifier)
        {
            PagedList <IndexAccount> pagedList = null;
            int totalCount           = 0;
            List <IndexAccount> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.Accounts_SelectPagByModifier_V2"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@PageIndex", pageIndex);
                paramCollection.AddWithValue("@PageSize", pageSize);
                paramCollection.AddWithValue("@AccountModifier", accountModifier);
            }
                                    , map : delegate(IDataReader reader, short set)
            {
                IndexAccount p = MapAccountPagination_V2(reader);

                if (list == null)
                {
                    list = new List <IndexAccount>();
                }
                list.Add(p);

                if (totalCount == 0)
                {
                    totalCount = p.TotalCount;
                }
            });
            if (list != null)
            {
                pagedList = new PagedList <IndexAccount>(list, 0, pageSize, totalCount);
            }

            return(pagedList);
        }
예제 #2
0
 public void create_IndexAccount()
 {
     this.create_generalAccount();
     IndexAccount             indexAccount = CreateIndexAccount();
     GeneralAccountRepository repository   = new GeneralAccountRepository();
     //repository.AddIndexAccount(indexAccount);
 }
예제 #3
0
        public static IndexAccount CreateIndexAccount()
        {
            var indexAccount = new IndexAccount {
                Id = Guid.NewGuid(), GeneralAccountCode = 1, Code = "1/0"
            };

            return(indexAccount);
        }
예제 #4
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();*/
        }
예제 #5
0
        public IndexAccountDto GetIndexAccount(string code)
        {
            IndexAccountRepository repository   = new IndexAccountRepository();
            IndexAccount           indexAccount = repository.ActiveContext.IndexAccounts
                                                  .Where(ia => ia != null && ia.Code == code)
                                                  .FirstOrDefault();

            if (indexAccount != null)
            {
                IndexAccountDto indexAccountDto = (IndexAccountDto) new IndexAccountDto().InjectFrom <UnflatLoopValueInjection>(indexAccount);
                if (indexAccount.GeneralAccount != null)
                {
                    indexAccountDto.GeneralAccountId = indexAccount.GeneralAccount.Id;
                }
                return(indexAccountDto);
            }
            return(null);
        }
예제 #6
0
        private IndexAccount MapAccountPagination_V2(IDataReader reader)
        {
            IndexAccount account       = new IndexAccount();
            int          startingIndex = 0;

            account.UserId          = reader.GetSafeString(startingIndex++);
            account.AvatarUrl       = reader.GetSafeString(startingIndex++);
            account.Handle          = reader.GetSafeString(startingIndex++);
            account.FirstName       = reader.GetSafeString(startingIndex++);
            account.MiddleInitial   = reader.GetSafeString(startingIndex++);
            account.LastName        = reader.GetSafeString(startingIndex++);
            account.GenderID        = reader.GetSafeInt16Nullable(startingIndex++);
            account.DOB             = reader.GetSafeDateTimeNullable(startingIndex++);
            account.Highlight       = reader.GetSafeBool(startingIndex++);
            account.AccountModifier = reader.GetSafeInt32(startingIndex++);
            account.TotalCount      = reader.GetSafeInt32(startingIndex++);

            return(account);
        }
예제 #7
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();
        }
예제 #8
0
 public string RemoveIndexAccount(Guid id)
 {
     try
     {
         IndexAccountRepository repository   = new IndexAccountRepository();
         IndexAccount           indexAccount =
             repository.ActiveContext.IndexAccounts.Include("Accounts").Where(ia => ia.Id == id).FirstOrDefault();
         if (indexAccount == null)
         {
             return("no record was found by this id");
         }
         if (indexAccount.ContainAccounts)
         {
             return("this record has account record and can not be deleted");
         }
         repository.Remove(indexAccount);
         return("has successfully created");
     }
     catch (Exception exception)
     {
         return(exception.Message);
     }
 }
예제 #9
0
 public string AddAccount(AccountDto accountDto)
 {
     try
     {
         AccountRepository repository   = new AccountRepository();
         IndexAccount      indexAccount =
             repository.ActiveContext.IndexAccounts.Include("BankAccounts")
             .FirstOrDefault(ia => ia.Id == accountDto.IndexAccountId);
         if (!indexAccount.ContainAccount(accountDto.Code))
         {
             Account account = new Account();
             accountDto.Id = Guid.NewGuid();
             account.InjectFrom <UnflatLoopValueInjection>(accountDto);
             account.IndexAccount = indexAccount;
             repository.Add(account);
             return("account is created");
         }
         return("account with this code is recreated !?");
     }
     catch (Exception exception)
     {
         return(exception.Message);
     }
 }
예제 #10
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);
     }
 }
예제 #11
0
 public static IndexAccount CreateIndexAccount()
 {
     var indexAccount = new IndexAccount { Id = Guid.NewGuid() ,GeneralAccountCode = 1,Code = "1/0"};
     return indexAccount;
 }
예제 #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;
     }
 }