Beispiel #1
0
        public ActionResult GetRatingHistory(string id)
        {
            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("zh-cn");
            var code = BondInfoRepository.GetBondCodeById(id);

            if (string.IsNullOrEmpty(code))
            {
                return(Json(new
                {
                    IssuerRatingList = new List <RATE_ORG_CRED_HIS>(),
                    BondRatingList = new List <BondRatingHist>(),
                }, JsonRequestBehavior.AllowGet));
            }
            var comCode             = ZcxRepository.GetComCodeFromBondCode(code).ToString();
            var issuerRatingHistory = ZcxRepository.GetIssuerRating(comCode).Select(i => new
            {
                RATE_DATE = i.RATE_WRIT_DATE.ToString("yyyy-MM-dd"),
                RATE_ORG  = i.Org,
                RATE      = i.ISS_CRED_LEVEL
            });
            var bondRatingHistory = BondReportRepository.GetBondRatingByCode(code).Select(b => new
            {
                RATE_DATE = b.RATE_DATE.ToString("yyyy-MM-dd"),
                RATE_ORG  = b.RATE_ORG,
                RATE      = b.RATE
            });

            return(Json(new
            {
                IssuerRatingList = issuerRatingHistory,
                BondRatingList = bondRatingHistory
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public BondRatingHistViewModel(string bondCode, BondReportRepository repository, ResearchReportRepository CMARepository)
        {
            RatingHistData = repository.GetBondRatingByCode(bondCode);
            var idlist = RatingHistData.Select(r => r.RATE_ID.ToString()).ToList();

            if (idlist != null && idlist.Count() != 0)
            {
                var ids       = idlist.Aggregate((a, b) => a + "," + b).ToString();
                var dataTable = CMARepository.CheckCommonFileExsit(ids, "RATE_REP_DATA", "RATE_ID");

                if (dataTable != null)
                {
                    foreach (DataRow row in dataTable.Rows)
                    {
                        RatingHistData.Where(r => r.RATE_ID == Convert.ToInt64(row["RATE_ID"])).ToList().ForEach(r => r.ContainFile = true);
                    }
                }
            }

            BondCode = bondCode;
        }