/// <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);
            }
        }
Beispiel #3
0
 public void AddGeneralAccountTest()
 {
     GeneralAccountDto generalAccountDto = new GeneralAccountDto();
           generalAccountDto.Category = 1;
           generalAccountDto.Code = 7;
           generalAccountDto.Description = "bank";
           PersonAccountService pa = new PersonAccountService();
       pa.AddGeneralAccount(generalAccountDto);
        //   GeneralAccountRepository repository = new GeneralAccountRepository();
      //      Assert.True(repository.ActiveContext.GeneralAccounts.Where(ga => ga.Code == 15).Count() == 1);
 }