public List <Models.MViewModels.MViewPaymentHistory> GetPaymentHistory(int OrderId) { List <Models.MViewModels.MViewPaymentHistory> PaymentHistory = new List <Models.MViewModels.MViewPaymentHistory>(); List <Models.MPayments> Payments = new List <Models.MPayments>(); List <Models.PaymentLine> PaymentsLine = new List <Models.PaymentLine>() , tempPaymentsLine = new List <Models.PaymentLine>(); Classes.CPayment cp = new CPayment(); Classes.CPaymentLine cpl = new CPaymentLine(); Classes.CBankOfAccount cb = new CBankOfAccount(); Classes.CCashAccount cca = new CCashAccount(); Payments = cp.GetAll(); Payments = Payments.Where(o => o.OrderId == OrderId).ToList(); PaymentsLine = cpl.GetAll(); for (int i = 0; i < Payments.Count; i++) { tempPaymentsLine.Clear(); tempPaymentsLine = PaymentsLine.Where(o => o.PaymentId == Payments[i].id).ToList(); float CummulativePayment = 0; for (int j = 0; j < tempPaymentsLine.Count; j++) { Models.MViewModels.MViewPaymentHistory ph = new Models.MViewModels.MViewPaymentHistory(); string AccountName = string.Empty; if (tempPaymentsLine[j].ModeOfPayment == Common.Constants.ModeOfPayment.Cheque.ToString()) { AccountName = cb.GetAccountNumberAccountTileById(tempPaymentsLine[j].BankId); } if (tempPaymentsLine[j].ModeOfPayment == Common.Constants.ModeOfPayment.Cash.ToString()) { AccountName = cca.GetAccountNameById(tempPaymentsLine[j].BankId); } ph.AccountName = AccountName; ph.ChequeNumber = tempPaymentsLine[j].Cheque; ph.Date = tempPaymentsLine[j].Date; ph.ModeOfPayment = tempPaymentsLine[j].ModeOfPayment; ph.PaidAmount = tempPaymentsLine[j].PaidAmount; CummulativePayment += Convert.ToSingle(tempPaymentsLine[j].PaidAmount); ph.CummulativePayment = CummulativePayment.ToString(); PaymentHistory.Add(ph); } } return(PaymentHistory); }
public List <Models.MAccountTransactionsView> GetAllViewAccounts() { Classes.CBankOfAccount cab = new CBankOfAccount(); List <Models.MAccountTransactionsView> GetAccounts = new List <Models.MAccountTransactionsView>(); var query = from o in obj.AccountTransactions select o; foreach (var item in query) { Models.MAccountTransactionsView mav = new Models.MAccountTransactionsView(); mav.AccountId = item.AccountId.ToString(); string[] AccountDetails = cab.GetAccountNumberAccountTileById(Convert.ToInt32(item.AccountId)).ToString().Split('-'); mav.AccountNumber = AccountDetails[0]; mav.AccountTitle = AccountDetails[1]; mav.Credit = Common.DynamicCaller.ConvertToDouble(item.Credit.ToString()).ToString(); mav.Debit = Common.DynamicCaller.ConvertToDouble(item.Debit.ToString()).ToString(); mav.Description = item.Description; mav.Total = Common.DynamicCaller.ConvertToDouble(item.Total.ToString()).ToString(); mav.eDate = item.eDate.ToString(); mav.FiscalYearId = item.FiscalYearId.ToString(); GetAccounts.Add(mav); } return(GetAccounts); }