/// <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 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();
        }
Beispiel #4
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();
        }
Beispiel #5
0
 public void create_IndexAccount()
 {
     this.create_generalAccount();
     IndexAccount indexAccount = CreateIndexAccount();
     GeneralAccountRepository repository = new GeneralAccountRepository();
     //repository.AddIndexAccount(indexAccount);
 }
Beispiel #6
0
 public void create_generalAccount()
 {
     GeneralAccount generalAccount = CreateGeneralAccount();
     GeneralAccountRepository repository = new GeneralAccountRepository();
     repository.Add(generalAccount);
 }
 public string RemoveGeneralAccount(Guid id)
 {
     try
     {
         GeneralAccountRepository repository = new GeneralAccountRepository();
         GeneralAccount generalAccount =
             repository.ActiveContext.GeneralAccounts.Include("IndexAccounts")
                       .Where(ga => ga.Id == id)
                       .FirstOrDefault();
         if (generalAccount == null) return "no record was found by this id";
         if (generalAccount.ContainIndexAccounts) return "this record has index account record and can not be deleted";
         repository.Remove(generalAccount);
         return "has successfully removed";
     }
     catch (Exception exception)
     {
         return exception.Message;
     }
 }
 public GeneralAccountDto GetGeneralAccount(int code)
 {
     GeneralAccountRepository repository = new GeneralAccountRepository();
     GeneralAccount general = repository.ActiveContext.GeneralAccounts
         .Where(ga => ga != null && ga.Code == code)
         .FirstOrDefault();
     return general != null
                ? (GeneralAccountDto)new GeneralAccountDto().InjectFrom<UnflatLoopValueInjection>(general)
                : null;
 }