Ejemplo n.º 1
0
        public List <RepoReportModel> GetRepoReport(SessionInfo sessioninfo, string strReportDate, string strSource, string strCtpy)
        {
            try
            {
                DateTime               dteReport;
                LimitCheckBusiness     _limitBusiness        = new LimitCheckBusiness();
                DealBusiness           _dealBusiness         = new DealBusiness();
                LimitProductBusiness   _limitProductBusiness = new LimitProductBusiness();
                LookupBusiness         _lookupBusiness       = new LookupBusiness();
                StaticDataBusiness     _staticBusiness       = new StaticDataBusiness();
                List <RepoReportModel> reports = new List <RepoReportModel>();
                RepoReportModel        report;
                Guid guCtpyID = Guid.Empty;

                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 (Guid.TryParse(strCtpy, out guCtpyID))
                {
                    guCtpyID = Guid.Parse(strCtpy);
                }

                Guid    guProductID  = _lookupBusiness.GetProductByUsercode(ProductCode.REPO.ToString()).ID;
                MA_PCCF rev_pccf     = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("84f608c9-8b58-48eb-a6dd-a5407548784a"));
                MA_PCCF rep_gov_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("28b24b19-e81d-4f82-a2f0-7c834ee3f91c"));
                MA_PCCF rep_soe_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("7014b05e-198f-4f62-94b0-1d54322efbca"));

                var limits = _limitBusiness.GetPCEByCriteria(dteReport, guCtpyID, guProductID, strSource, Guid.Empty, Guid.Empty).Distinct(new LimitCheckComparer()).ToList();

                foreach (LimitCheckModel limit in limits)
                {
                    report = new RepoReportModel();

                    report.PROCESSING_DATE = limit.PROCESSING_DATE;
                    report.SNAME           = limit.SNAME;
                    report.LIMIT_LABEL     = limit.LIMIT_LABEL;
                    report.GEN_AMOUNT      = limit.GEN_AMOUNT;
                    report.TEMP_AMOUNT     = limit.TEMP_AMOUNT;
                    //report.AMOUNT = limit.AMOUNT;
                    report.EXPIRE_DATE            = limit.EXPIRE_DATE;
                    report.ORIGINAL_KK_CONTRIBUTE = limit.ORIGINAL_KK_CONTRIBUTE;
                    report.DEAL_CONTRIBUTION      = 0;
                    report.REV_AMOUNT             = report.AVAILABLE / rev_pccf.C1.Value * 100;
                    report.REP_GOV_5_AMOUNT       = report.AVAILABLE / rep_gov_pccf.C5.Value * 100;
                    report.REP_GOV_10_AMOUNT      = report.AVAILABLE / rep_gov_pccf.C10.Value * 100;
                    report.REP_GOV_20_AMOUNT      = report.AVAILABLE / rep_gov_pccf.C20.Value * 100;
                    report.REP_GOV_20s_AMOUNT     = report.AVAILABLE / rep_gov_pccf.more20.Value * 100;
                    report.REP_SOE_5_AMOUNT       = report.AVAILABLE / rep_soe_pccf.C5.Value * 100;
                    report.REP_SOE_10_AMOUNT      = report.AVAILABLE / rep_soe_pccf.C10.Value * 100;
                    report.REP_SOE_20_AMOUNT      = report.AVAILABLE / rep_soe_pccf.C20.Value * 100;
                    report.REP_SOE_20s_AMOUNT     = report.AVAILABLE / rep_soe_pccf.more20.Value * 100;

                    reports.Add(report);
                }

                return(reports);
            }

            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }
Ejemplo n.º 2
0
        public List<RepoReportModel> GetRepoReport(SessionInfo sessioninfo, string strReportDate, string strSource, string strCtpy)
        {
            try
            {
                DateTime dteReport;
                LimitCheckBusiness _limitBusiness = new LimitCheckBusiness();
                DealBusiness _dealBusiness = new DealBusiness();
                LimitProductBusiness _limitProductBusiness = new LimitProductBusiness();
                LookupBusiness _lookupBusiness = new LookupBusiness();
                StaticDataBusiness _staticBusiness = new StaticDataBusiness();
                List<RepoReportModel> reports = new List<RepoReportModel>();
                RepoReportModel report;
                Guid guCtpyID = Guid.Empty;

                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 (Guid.TryParse(strCtpy, out guCtpyID))
                {
                    guCtpyID = Guid.Parse(strCtpy);
                }

                Guid guProductID = _lookupBusiness.GetProductByUsercode(ProductCode.REPO.ToString()).ID;
                MA_PCCF rev_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("84f608c9-8b58-48eb-a6dd-a5407548784a"));
                MA_PCCF rep_gov_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("28b24b19-e81d-4f82-a2f0-7c834ee3f91c"));
                MA_PCCF rep_soe_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("7014b05e-198f-4f62-94b0-1d54322efbca"));

                var limits = _limitBusiness.GetPCEByCriteria(dteReport, guCtpyID, guProductID, strSource, Guid.Empty, Guid.Empty).Distinct(new LimitCheckComparer()).ToList();

                foreach (LimitCheckModel limit in limits)
                {
                    report = new RepoReportModel();

                    report.PROCESSING_DATE = limit.PROCESSING_DATE;
                    report.SNAME = limit.SNAME;
                    report.LIMIT_LABEL = limit.LIMIT_LABEL;
                    report.GEN_AMOUNT = limit.GEN_AMOUNT;
                    report.TEMP_AMOUNT = limit.TEMP_AMOUNT;
                    //report.AMOUNT = limit.AMOUNT;
                    report.EXPIRE_DATE = limit.EXPIRE_DATE;
                    report.ORIGINAL_KK_CONTRIBUTE = limit.ORIGINAL_KK_CONTRIBUTE;
                    report.DEAL_CONTRIBUTION = 0;
                    report.REV_AMOUNT = report.AVAILABLE / rev_pccf.C1.Value * 100;
                    report.REP_GOV_5_AMOUNT = report.AVAILABLE / rep_gov_pccf.C5.Value * 100;
                    report.REP_GOV_10_AMOUNT = report.AVAILABLE / rep_gov_pccf.C10.Value * 100;
                    report.REP_GOV_20_AMOUNT = report.AVAILABLE / rep_gov_pccf.C20.Value * 100;
                    report.REP_GOV_20s_AMOUNT = report.AVAILABLE / rep_gov_pccf.more20.Value * 100;
                    report.REP_SOE_5_AMOUNT = report.AVAILABLE / rep_soe_pccf.C5.Value * 100;
                    report.REP_SOE_10_AMOUNT = report.AVAILABLE / rep_soe_pccf.C10.Value * 100;
                    report.REP_SOE_20_AMOUNT = report.AVAILABLE / rep_soe_pccf.C20.Value * 100;
                    report.REP_SOE_20s_AMOUNT = report.AVAILABLE / rep_soe_pccf.more20.Value * 100;

                    reports.Add(report);
                }

                return reports;
            }

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