public void Create_Account() { this.create_IndexAccount(); Account account = CreateAccount(); IndexAccountRepository repository = new IndexAccountRepository(); //repository.AddAccount(account); }
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); }
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); } }
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); } }
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; } }
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; } }
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; }