public OrgAccountViewModel InitializeOrgAccountViewModel(OrgAccount item) { var account = new OrgAccountViewModel(); switch (item.AccountType) { case "Готівка": account = this.InitializeCommonProperties(item); account.AccountType = "Готівка"; break; case "Банк": account = this.InitializeCommonProperties(item); account.AccountType = "Банк"; account.BankName = item.BankAccount.BankName; account.AccNumber = item.BankAccount.AccNumber; account.EDRPOU = item.BankAccount.EDRPOU; account.MFO = item.BankAccount.MFO; account.Description = item.Description; account.CardNumber = item.BankAccount.CardNumber; account.BankAccId = item.BankAccId; break; default: break; } return(account); }
public OrgAccountViewModel CreateCashAccount(OrgAccountViewModel model) { var account = new OrgAccount(); try { var message = this.ValidateOrgAccount(model); if (message != String.Empty) { return(new OrgAccountViewModel { Error = message }); } account.AccountType = "Готівка"; Int32.TryParse(model.Currency, out var currencyId); account.Currency = this._unitOfWork.CurrencyRepositry.Get(currencyId); account.CurrentBalance = model.CurrentBalance; account.OrgAccountName = model.OrgAccountName; account.Organization = this._unitOfWork.OrganizationRepository.Get(model.OrgId); account.TargetId = model.TargetId; this._unitOfWork.OrganizationAccountRepository.Create(account); this._unitOfWork.SaveChanges(); return((OrgAccountViewModel)account); } catch (Exception e) { string message = string.Format("Неможливо створити рахунок організації. Помилка: {0}", e.Message); throw new BusinessLogicException(message, e); } }
public OrgAccountViewModel CreateCashAccount(OrgAccountViewModel model) { var account = new OrgAccount(); try { var message = this.ValidateOrgAccount(model); if (message != String.Empty) { return(new OrgAccountViewModel { Error = message }); } account.AccountType = "Готівка"; Int32.TryParse(model.Currency, out var currencyId); account.Currency = this._unitOfWork.CurrencyRepositry.Get(currencyId); account.CurrentBalance = model.CurrentBalance; account.OrgAccountName = model.OrgAccountName; account.Organization = this._unitOfWork.OrganizationRepository.Get(model.OrgId); account.TargetId = model.TargetId; account.Description = model.Description; account.UserId = model.UserId; account.CreationDate = model.CreationDate; this._unitOfWork.OrganizationAccountRepository.Create(account); this._unitOfWork.SaveChanges(); return((OrgAccountViewModel)account); } catch (Exception e) { throw new BusinessLogicException(ErrorMessages.CantCreateAccountOfOrganization, e); } }
public OrgAccountViewModel InitializeCommonProperties(OrgAccount item) { return(new OrgAccountViewModel { Id = item.Id, OrgAccountName = item.OrgAccountName, OrgId = item.OrgId, Currency = item.Currency.FullName, CurrencyId = item.CurrencyId, CurrencyShortName = item.Currency.ShortName, CurrentBalance = item.CurrentBalance, TargetId = item.TargetId }); }
public OrgAccountViewModel InitializeCommonProperties(OrgAccount item) { return(new OrgAccountViewModel { Id = item.Id, OrgAccountName = item.OrgAccountName, OrgId = item.OrgId, Currency = item.Currency.FullName, CurrencyId = item.CurrencyId, CurrencyShortName = item.Currency.ShortName, CurrentBalance = item.CurrentBalance, TargetId = item.TargetId, Description = item.Description, UserId = item.UserId, FirstName = item.User?.FirstName, LastName = item.User?.LastName, CreationDate = item.CreationDate }); }
/// <summary> /// Configures model creation /// </summary> /// <param name="modelBuilder">modelBuilder to configure Model Creation</param> protected override void OnModelCreating(ModelBuilder modelBuilder) { User.Configure(modelBuilder); Phone.Configure(modelBuilder); Address.Configure(modelBuilder); UserAddress.Configure(modelBuilder); Role.Configure(modelBuilder); Organization.Configure(modelBuilder); OrgAddress.Configure(modelBuilder); ExternalContact.Configure(modelBuilder); Membership.Configure(modelBuilder); Currency.Configure(modelBuilder); BankAccount.Configure(modelBuilder); OrgAccount.Configure(modelBuilder); Balance.Configure(modelBuilder); Target.Configure(modelBuilder); FinOp.Configure(modelBuilder); Tag.Configure(modelBuilder); TagFinOp.Configure(modelBuilder); Event.Configure(modelBuilder); EventImage.Configure(modelBuilder); Complaint.Configure(modelBuilder); GoodsType.Configure(modelBuilder); GoodsCategory.Configure(modelBuilder); OfferedItem.Configure(modelBuilder); RequestedItem.Configure(modelBuilder); BankImport.Configure(modelBuilder); BankImportDetail.Configure(modelBuilder); PasswordReset.Configure(modelBuilder); BannedUser.Configure(modelBuilder); BannedOrganization.Configure(modelBuilder); SubscribeOrganization.Configure(modelBuilder); Status.Configure(modelBuilder); OfferedItemImage.Configure(modelBuilder); RequestedItemImage.Configure(modelBuilder); UserResponse.Configure(modelBuilder); OrganizationResponse.Configure(modelBuilder); Donation.Configure(modelBuilder); Bank.Configure(modelBuilder); AutoImportIntervals.Configure(modelBuilder); }
/// <summary/> public Payee(OrganizationType organization, OrgAccount orgAccount) : base(organization) => OrgAccount = orgAccount;
private OrgAccountDetailViewModel ConvertOrgAccountToOrgAccountDetailViewModel(OrgAccount account) { OrgAccountDetailViewModel orgAccountDetail = new OrgAccountDetailViewModel { AccountDescription = account.Description, Name = account.OrgAccountName }; orgAccountDetail.Target = account.Target?.TargetName; if (account.BankAccount != null && account.BankAccount.CardNumber != null) { orgAccountDetail.CardNumber = account.BankAccount.CardNumber; } return(orgAccountDetail); }
public OrgAccount Edit(OrgAccount item) { var updatedItem = this._context.OrgAccounts.Update(item); return(updatedItem.Entity); }
public OrgAccount Create(OrgAccount item) { var orgAccount = this._context.OrgAccounts.Add(item); return(orgAccount.Entity); }
public bool IsExtractsEnabled(int orgAccountId) { OrgAccount orgAccount = _unitOfWork.OrganizationAccountRepository.GetOrgAccountById(orgAccountId); return(orgAccount?.BankAccount?.IsExtractEnabled ?? false); }