Esempio n. 1
0
        public List <DA_TRN_CASHFLOW> GetSCEDetailReport(SessionInfo sessioninfo, string strReportDate, string strCtpy, string strProduct, string strSource)
        {
            try
            {
                DateTime     dteReport;
                DealBusiness _dealBusiness = new DealBusiness();
                Guid         guTemp;

                if (String.IsNullOrEmpty(strReportDate))
                {
                    throw this.CreateException(new Exception(), "Please input report date.");
                }
                else if (!DateTime.TryParseExact(strReportDate, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReport))
                {
                    throw this.CreateException(new Exception(), "Invalid report date.");
                }
                else
                {
                    dteReport = DateTime.ParseExact(strReportDate, "dd/MM/yyyy", null);
                }

                if (_dealBusiness.CountByProcessDate(dteReport) == 0)
                {
                    throw this.CreateException(new Exception(), "No data for selected report date.");
                }

                var cashflows = _dealBusiness.GetFlowsByProcessDate(dteReport).AsQueryable();

                if (!string.IsNullOrEmpty(strSource))
                {
                    cashflows = cashflows.Where(p => p.DA_TRN.SOURCE == strSource);
                }

                if (Guid.TryParse(strCtpy, out guTemp))
                {
                    cashflows = cashflows.Where(p => p.DA_TRN.CTPY_ID == Guid.Parse(strCtpy));
                }

                if (Guid.TryParse(strProduct, out guTemp))
                {
                    cashflows = cashflows.Where(p => p.DA_TRN.PRODUCT_ID == Guid.Parse(strProduct));
                }

                return(cashflows.OrderBy(p => p.DA_TRN.INT_DEAL_NO).ThenByDescending(p => p.FLAG_FIRST).ThenBy(p => p.SEQ).ToList());
            }

            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }