コード例 #1
0
ファイル: AccountTest.cs プロジェクト: rahman-vali/Valiasr
 public void Create_Account()
 {
     this.create_IndexAccount();
     Account account = CreateAccount();
     IndexAccountRepository repository = new IndexAccountRepository();
     //repository.AddAccount(account);
 }
コード例 #2
0
 public void Create_Account()
 {
     this.create_IndexAccount();
     Account account = CreateAccount();
     IndexAccountRepository repository = new IndexAccountRepository();
     //repository.AddAccount(account);
 }
コード例 #3
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);
        }
コード例 #4
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);
     }
 }
コード例 #5
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);
     }
 }
コード例 #6
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;
     }
 }
コード例 #7
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;
     }
 }
コード例 #8
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;
        }