Пример #1
0
        /// <summary>
        /// To Get DepositLogs depending on DepositeDate and ClientCode
        /// </summary>
        /// <param name="clientCode"></param>
        /// <param name="depositDate"></param>
        /// <returns></returns>
        public DepositLogClientDataViewModel GetDepositLogsOfClientForDate(string clientCode, DateTime depositDate)
        {
            DepositLogClientDataViewModel depositLogClientData = new DepositLogClientDataViewModel();

            try
            {
                List <BusinessModel.BusinessModels.ClientPayer> payerDetails = _depositLogResposiotory.GetDepositLogsForClientDate(clientCode, depositDate);
                depositLogClientData.ClientCode = clientCode;
                depositLogClientData.Date       = depositDate.Date;
                depositLogClientData.Payers     = new List <PayerDataViewModel>();
                if (payerDetails?.Count > 0)
                {
                    foreach (BusinessModel.BusinessModels.ClientPayer payer in payerDetails)
                    {
                        PayerDataViewModel clientPayer = new PayerDataViewModel();
                        clientPayer.PayerCode = payer.Payer?.PayerCode;
                        clientPayer.PayerName = payer.Payer?.PayerName;
                        clientPayer.Amount    = payer.DepositLog?.First().Amount;
                        depositLogClientData.Payers.Add(clientPayer);
                    }
                }
                else
                {
                    depositLogClientData.Payers = GetPayersForClient(clientCode);
                }
                depositLogClientData.Total         = depositLogClientData.Payers.Sum(c => c.Amount);
                depositLogClientData.IsMonthClosed = _depositLogResposiotory.IsMonthOfAYearClosedForAClient(clientCode, depositDate.Month, depositDate.Year);
                return(depositLogClientData);
            }
            catch (Exception ex)
            {
                _logger.Log(ex, LogLevel.Error, ex.Message);
                return(depositLogClientData);
            }
        }
Пример #2
0
        private List <PayerDataViewModel> GetPayersForClient(string clientCode)
        {
            List <PayerDataViewModel> clientPayers = new List <PayerDataViewModel>();
            List <BusinessModel.BusinessModels.Payer> payerDetails = _depositLogResposiotory.GetPayerDetailsForClient(clientCode);

            foreach (BusinessModel.BusinessModels.Payer payer in payerDetails)
            {
                PayerDataViewModel clientPayer = new PayerDataViewModel();
                clientPayer.PayerCode = payer.PayerCode;
                clientPayer.PayerName = payer.PayerName;
                clientPayers.Add(clientPayer);
            }
            return(clientPayers);
        }