public void SetOptionDirection(OpenMarketRepo repo, int flag, GlobalValueParams globalValues) { if (flag == 1) { repo.Direction = globalValues.Direction_injection; } else if (flag == -1) { repo.Direction = globalValues.Direction_withdrawal; repo.Amount = -repo.Amount; repo.Volume = -repo.Volume; } }
/// <summary> /// set every item's OptionType in openMarketRepo /// </summary> /// <param name="type"> the type that seleceted from the drop down list</param> /// <param name="repo">the object that returned from the service layer</param> /// <returns></returns> public List <OpenMarketRepo> SetOptionType(DetailDataReportParams reportPara, IEnumerable <OpenMarketRepo> repo, GlobalValueParams globalValues) { List <OpenMarketRepo> repoRet = new List <OpenMarketRepo>(); var repoList = repo.Where(r => r.IssueDate != null).Select(r => r).ToList(); foreach (OpenMarketRepo item in repoList) { string typeTemp = item.OperationType; int flag = 0; switch (item.OperationType) { case ConstValues.Type_CBankBill: item.Category = globalValues.Type_CBankBill; item.OperationType = globalValues.Type_CBankBill; flag = -1; break; case ConstValues.Type_CBankBillIE: item.Category = globalValues.Type_CBankBill; item.OperationType = globalValues.Type_CBankBillIE; flag = 1; break; case ConstValues.Type_FMD: item.Category = globalValues.Type_FMD; item.OperationType = globalValues.Type_FMD; flag = 1; break; case ConstValues.Type_FMDIE: item.Category = globalValues.Type_FMD; item.OperationType = globalValues.Type_FMDIE; flag = -1; break; case ConstValues.Type_MLF: item.Category = globalValues.Type_MLF; item.OperationType = globalValues.Type_MLF; flag = 1; break; case ConstValues.Type_MLFIE: item.Category = globalValues.Type_MLFIE; item.OperationType = globalValues.Type_MLFIE; flag = -1; break; case ConstValues.Type_ReverseRepo: item.Category = globalValues.Type_ReverseRepo; item.OperationType = globalValues.Type_ReverseRepo; flag = 1; break; case ConstValues.Type_ReverseRepoIE: item.Category = globalValues.Type_ReverseRepo; item.OperationType = globalValues.Type_ReverseRepoIE; flag = -1; break; case ConstValues.Type_Repo: item.Category = globalValues.Type_Repo; item.OperationType = globalValues.Type_Repo; flag = -1; break; case ConstValues.Type_RepoIE: item.Category = globalValues.Type_Repo; item.OperationType = globalValues.Type_RepoIE; flag = 1; break; default: break; } SetOptionDirection(item, flag, globalValues); SetOptionTerm(globalValues.CurrentContext, item); item.Volume = SwitchAmountUnit(reportPara.Unit, item.Volume); item.Amount = SwitchAmountUnit(reportPara.Unit, item.Amount); item.Term = Convert.ToInt32(((DateTime)item.MaturityDate).Subtract((DateTime)item.IssueDate).Duration().Days); if (reportPara.Type == ConstValues.Type_All) { repoRet.Add(item); } else if (typeTemp == reportPara.Type || typeTemp == reportPara.Type + "IE") { repoRet.Add(item); } else if (reportPara.Type.Split(',').Contains(typeTemp.Replace("IE", ""))) { repoRet.Add(item); } } return(repoRet); }
/// <summary> /// Get data used by open market report /// </summary> /// <returns></returns> public IEnumerable <OpenMarketRepo> GetOpenMarketRepo(DetailDataReportParams reportPara, GlobalValueParams globalValues) { IEnumerable <OpenMarketRepo> openMarketRepo = OpenMarketReportRepository.GetOpenMarketRepo(reportPara); IEnumerable <OpenMarketRepo> repoRet = SetOptionType(reportPara, openMarketRepo, globalValues); return(repoRet); }