public static object GetPCCFFXSpotByLabel(SessionInfo sessioninfo, string CCYPairLabel) { StaticDataBusiness _staticBusiness = new StaticDataBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); var productID = _lookupBusiness.GetProductAll().FirstOrDefault(p => p.LABEL.Replace(" ", string.Empty) == ProductCode.FXSPOT.ToString()).ID; MA_PCCF pccf = _staticBusiness.GetPCCFByLabelProduct(sessioninfo, CCYPairLabel, productID); if (pccf != null) { return(null);// new { CURRENCY1 = pccf.MA_CURRENCY1.LABEL, CURRENCY2 = pccf.MA_CURRENCY2.LABEL, CURRENCYID1 = pccf.MA_CURRENCY1.ID, CURRENCYID2 = pccf.MA_CURRENCY2.ID, FLAG_MULTIPLY = pccf.FLAG_MULTIPLY }; } else { throw new Exception("Invalid currency pair."); } }
public static object GetPCCFOptions(SessionInfo sessioninfo) { try { StaticDataBusiness _staticBusiness = new StaticDataBusiness(); //Get data from database var pccfs = _staticBusiness.GetPCCFAll().Where(t => t.ISACTIVE == true); //Return result to jTable return(new { Result = "OK", Options = pccfs.OrderBy(t => t.LABEL).Select(c => new { DisplayText = c.LABEL, Value = c.ID }) }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object Update(SessionInfo sessioninfo, MA_PCCF record) { try { StaticDataBusiness _staticBusiness = new StaticDataBusiness(); //record.FLAG_MULTIPLY = record.FLAG_MULTIPLY == null || !record.FLAG_MULTIPLY.Value ? false : true; record.LABEL = record.LABEL.ToUpper(); record.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId; record.LOG.MODIFYDATE = DateTime.Now; _staticBusiness.UpdatePCCF(sessioninfo, record); return(new { Result = "OK", Record = record }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object GetPCCFByFilter(SessionInfo sessioninfo, string label, int jtStartIndex, int jtPageSize, string jtSorting) { try { StaticDataBusiness _staticBusiness = new StaticDataBusiness(); //Get data from database List <MA_PCCF> pccfs = _staticBusiness.GetPCCFByFilter(sessioninfo, label, jtSorting); //Return result to jTable return(new { Result = "OK", Records = jtPageSize > 0 ? pccfs.Skip(jtStartIndex).Take(jtPageSize).ToList() : pccfs, TotalRecordCount = pccfs.Count }); } catch (BusinessWorkflowsException bex) { return(new { Result = "ERROR", Message = bex.Message }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
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); } }