public int AddEditAccount(AccountDetailEntity cashbankEntity) { IAccountDetailsBL cashbankBL = new AccountDetailsBL(); int result = cashbankBL.AddEditAccount(cashbankEntity); return(result); }
public AccountDetailEntity GetDefaultAccount() { IAccountDetailsBL cashbankBL = new AccountDetailsBL(); AccountDetailEntity result = cashbankBL.GetDefaultAccount(); return(result); }
public AccountDetailEntity GetAccInfo(int AccountId) { IAccountDetailsBL cashbankBL = new AccountDetailsBL(); AccountDetailEntity result = cashbankBL.GetAccInfo(AccountId); return(result); }
public async Task <LockableResult <AccountDetailsOutDto> > Create(AccountNewDto accountIn) { if (accountIn.AuthorizedLimit != null && accountIn.AuthorizedLimit.Currency != accountIn.InitialBalance.Currency) { return(new BadRequestLockableResult <AccountDetailsOutDto>(BadRequestOutDto.WrongCurrencyType)); } var rand = new Random(); var dateTimeNow = DateTimeOffset.UtcNow; var accountDetailEntity = new AccountDetailEntity() { ResourceId = Guid.NewGuid(), Name = accountIn.Name, Product = accountIn.Product, CashAccountType = accountIn.CashAccountType, Status = accountIn.Status, Usage = accountIn.Usage, Lock = null, Pan = string.Join("", "000123456789".Select(c => rand.Next(0, 10))), Msisdn = accountIn.Msisdn, Currency = accountIn.InitialBalance.Currency, RoutingNumbers = new AccountReferenceEntity.RoutingNumbersEntity() { Ach = AabRoutingNumbers.GetRandomRoutingNumber() }, Balances = new BalanceEntity[] { new BalanceEntity() { BalanceType = BalanceTypeEnum.closingBooked, BalanceAmount = accountIn.InitialBalance.ToEntity(), CreditLimitIncluded = false, LastChangeDateTime = dateTimeNow, LastCommittedTransaction = null }, }, AuthorizedLimit = accountIn.AuthorizedLimit?.ToEntity() }; if (accountIn.AuthorizedLimit != null) { accountDetailEntity.Balances = accountDetailEntity.Balances.Concat(new BalanceEntity[] { new BalanceEntity() { BalanceType = BalanceTypeEnum.authorised, BalanceAmount = accountIn.InitialBalance.ToEntity().Add(accountIn.AuthorizedLimit.ToEntity()), CreditLimitIncluded = true, LastChangeDateTime = dateTimeNow, LastCommittedTransaction = null }, }); } accountDetailEntity.LastModifiedDate = dateTimeNow; accountDetailEntity.CreatedDate = dateTimeNow; await _accounts.InsertOneAsync(accountDetailEntity); return(new SuccessfulLockableResult <AccountDetailsOutDto>(AccountDetailsOutDto.EntityToOutDto(accountDetailEntity))); }
public int Insert(AccountDetailEntity t) { using (BrightourDbContext db = new BrightourDbContext()) { var log = db.AccountDetailInfo.Add(t); db.SaveChanges(); return(log.ADid); } }
public static AccountTransactionsListOutDto BuildFromEntities(AccountDetailEntity accountDetailEntity, ICollection <TransactionEntity> transactionEntities) { return(new AccountTransactionsListOutDto() { Account = AccountReferenceOutDto.EntityToOutDto <AccountReferenceOutDto>(accountDetailEntity), Transactions = new TransactionListsOutDto() { Booked = transactionEntities.Where(t => t.BookingStatus == BookingStatusEnum.BOOKED) .Select(TransactionDetailsOutDto.EntityToOutDto), Pending = transactionEntities.Where(t => t.BookingStatus == BookingStatusEnum.PENDING) .Select(TransactionDetailsOutDto.EntityToOutDto) } }); }
public int AddEditAccount(AccountDetailEntity cashbankEntity) { IAccountDetialsDAL AccountDetails = new AccountDetialDAL(); //var openingbal = Convert.ToDecimal(cashbankEntity.AccountOpeningBal); cashbankEntity.AccountOpeningBal = string.Format("{0:G29}", decimal.Parse(cashbankEntity.AccountOpeningBal)); if (cashbankEntity.IsInActive == true) { cashbankEntity.IsInActivestring = "Y"; } else { cashbankEntity.IsInActivestring = "N"; } int result = AccountDetails.AddEditAccount(cashbankEntity); return(result); }
public void RefreshPage() { SelectedAccount = null; // Unselects last selection. Essential, as assignment below won't clear other control's SelectedItems var Account = new AccountDetailEntity(); IAccountDetailsService AccountDetails = new AccountDetailsService(); var results = AccountDetails.GetDefaultAccount(); var accountinfo = AccountDetails.GetAccountDetails(); if (results != null) { results.AccountDetails = accountinfo; results.SeletedIndex = 0; results.EnablePrevious = false; int minHeight = 300; int headerRows = 380;//180+40+30+10; var height = System.Windows.SystemParameters.PrimaryScreenHeight - headerRows - 70; bool validHeight = int.TryParse(height.ToString(), out minHeight); results.AccountGridHeight = minHeight; SelectedAccount = results; ActiveAccounts = Convert.ToString(accountinfo.Where(e => e.IsInactive == "Y").Count()); InActiveAccounts = Convert.ToString(accountinfo.Where(e => e.IsInactive == "N").Count()); } //this.AccountDetails = customerRepository.GetAllCustomers().ToList(); //if (SearchCustomer.Count > 0) //{ // this.SelectedSearchCustmer = SearchCustomer[0].ID; // custId = SearchCustomer[0].ID; //} //else //{ // this.SelectedSearchCustmer = custId; //} //this.GetData(this.SelectedSearchCustmer); }
public static AccountDetailsOutDto EntityToOutDto(AccountDetailEntity accountDetailEntity) { var accountDetailsFromReference = AccountReferenceOutDto.EntityToOutDto <AccountDetailsOutDto>(accountDetailEntity); accountDetailsFromReference.ResourceId = accountDetailEntity.ResourceId; accountDetailsFromReference.Name = accountDetailEntity.Name; accountDetailsFromReference.Product = accountDetailEntity.Product; accountDetailsFromReference.CashAccountType = accountDetailEntity.CashAccountType; accountDetailsFromReference.Status = accountDetailEntity.Status; accountDetailsFromReference.Usage = accountDetailEntity.Usage; accountDetailsFromReference.Balances = accountDetailEntity.Balances.Select(BalanceOutDto.EntityToOutDto); accountDetailsFromReference.Lock = LockOutDto.EntityToOutDto(accountDetailEntity.Lock); accountDetailsFromReference.LastModifiedDate = accountDetailEntity.LastModifiedDate; accountDetailsFromReference.CreatedDate = accountDetailEntity.CreatedDate; accountDetailsFromReference.AuthorizedLimit = accountDetailEntity.AuthorizedLimit != null ? AmountOutDto.EntityToOutDto(accountDetailEntity.AuthorizedLimit) : null; return(accountDetailsFromReference); }
public int AddEditAccount(AccountDetailEntity cashbankentity) { try { var cashbank = entites.Accounts.Where(x => x.ID == cashbankentity.AccountID).FirstOrDefault(); var checkduplicate = entites.Accounts.Where(x => x.Acc_Name.ToLower() == cashbankentity.AccountName.ToLower() && x.IsDeleted != true).FirstOrDefault(); //if (checkduplicate != null) //{ // return 2; //} //else //{ if (cashbank != null) { cashbank.Acc_Name = cashbankentity.AccountName; cashbank.Acc_Open_Bal = cashbankentity.AccountOpeningBal == null ? null as decimal? : Convert.ToDecimal(cashbankentity.AccountOpeningBal); cashbank.Acc_Inactive = cashbankentity.IsInActivestring; cashbank.Acc_Type = Convert.ToInt32(cashbankentity.SeletedAccountType); entites.SaveChanges(); //while update accounts string accountName = cashbankentity.AccountName.ToString(); if (Convert.ToInt32(cashbankentity.SeletedAccountType) != 0) { var status = entites.Accounts.SqlQuery("USP_UpdateUserCreatedAccountInfo @acctype,@accountName", new SqlParameter("acctype", Convert.ToInt32(cashbankentity.SeletedAccountType)), new SqlParameter("accountName", cashbankentity.AccountName)).SingleOrDefault(); } return(1); } else { if (checkduplicate != null) { return(2); } int acctype = Convert.ToInt32(cashbankentity.SeletedAccountType); Account AccDetail = new Account() { Acc_Name = cashbankentity.AccountName, Acc_Open_Bal = cashbankentity.AccountOpeningBal == null ? null as decimal? : Convert.ToDecimal(cashbankentity.AccountOpeningBal), Acc_Inactive = cashbankentity.IsInActivestring, Acc_Type = acctype }; //if (cashbankentity.AccountName.ToLower().Trim() == "cash") //{ // //var accType = entites.AccountTypes.Where(x => x.Acc_Type_Code == "CAB").FirstOrDefault(); // //if (accType != null) // // AccDetail.Acc_Type = accType.ID; // return 2; //} //else //{ // var accType = entites.AccountTypes.Where(x => x.Acc_Type_Code == "ACB").FirstOrDefault(); // if (accType != null) // AccDetail.Acc_Type = accType.ID; //} entites.Accounts.Add(AccDetail); entites.SaveChanges(); //while Creating new Accounts accounts string accountName = cashbankentity.AccountName.ToString(); if (acctype != 0) { var status = entites.Accounts.SqlQuery("USP_UpdateUserCreatedAccountInfo @acctype,@accountName", new SqlParameter("acctype", acctype), new SqlParameter("accountName", accountName)).SingleOrDefaultAsync(); } return(1); } //} } catch (Exception ex) { return(3); throw ex; } }
public int AddEditAccount(AccountDetailEntity cashbankentity) { try { var cashbank = entites.Accounts.Where(x => x.ID == cashbankentity.AccountID).FirstOrDefault(); var checkduplicate = entites.Accounts.Where(x => x.Acc_Name.ToLower() == cashbankentity.AccountName.ToLower() && x.IsDeleted != true).FirstOrDefault(); //if (checkduplicate != null) //{ // return 2; //} //else //{ if (cashbank != null) { cashbank.Acc_Name = cashbankentity.AccountName; cashbank.Acc_Open_Bal = cashbankentity.AccountOpeningBal == null ? null as decimal? : Convert.ToDecimal(cashbankentity.AccountOpeningBal); cashbank.Acc_Inactive = cashbankentity.IsInActivestring; cashbank.Acc_Type = Convert.ToInt32(cashbankentity.SeletedAccountType); entites.SaveChanges(); return(1); } else { if (checkduplicate != null) { return(2); } int acctype = Convert.ToInt32(cashbankentity.SeletedAccountType); Account AccDetail = new Account() { Acc_Name = cashbankentity.AccountName, Acc_Open_Bal = cashbankentity.AccountOpeningBal == null ? null as decimal? : Convert.ToDecimal(cashbankentity.AccountOpeningBal), Acc_Inactive = cashbankentity.IsInActivestring, Acc_Type = acctype }; //if (cashbankentity.AccountName.ToLower().Trim() == "cash") //{ // //var accType = entites.AccountTypes.Where(x => x.Acc_Type_Code == "CAB").FirstOrDefault(); // //if (accType != null) // // AccDetail.Acc_Type = accType.ID; // return 2; //} //else //{ // var accType = entites.AccountTypes.Where(x => x.Acc_Type_Code == "ACB").FirstOrDefault(); // if (accType != null) // AccDetail.Acc_Type = accType.ID; //} entites.Accounts.Add(AccDetail); entites.SaveChanges(); return(1); } //} } catch (Exception ex) { return(3); throw ex; } }
public int AddAccountDetail(AccountDetailModel t) { AccountDetailEntity accountDetailEntity = Mapper.Map <AccountDetailModel, AccountDetailEntity>(t); return(_dal.Insert(accountDetailEntity)); }
public int Delete(AccountDetailEntity t) { throw new NotImplementedException(); }
public int Update(AccountDetailEntity t, string[] properties = null) { throw new NotImplementedException(); }