public ActionResult Create(FormCollection formCollection) { // try // { ElevatorBusiness ElevatorBusiness = new ElevatorBusiness(new ElevatorDataAccess()); LookupBusiness lookupBusiness = new LookupBusiness(new LookupDataAccess()); ElevatorCoreModel.Elevator elevator = new ElevatorCoreModel.Elevator { CreatedByUserId = 1, // (int)Session["ElevatorId"]; ModifiedByUserId = 2, // (int)Session["ElevatorId"]; ElevatorName = formCollection["ElevatorName"], FloorDuration = Convert.ToInt32(formCollection["FloorDuration"]), MaxWeight = Convert.ToInt32(formCollection["MaxWeight"]), CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now, MainStatusId = lookupBusiness.GetLookupId("MainStatus", formCollection["MainStatus"]), }; ElevatorBusiness.Create(elevator); return(RedirectToAction("Index")); //} //catch //{ // return View(); //} }
// GET: User public ActionResult Index() { UserBusiness userBusiness = new UserBusiness(new UserDataAccess()); LookupBusiness lookupBusiness = new LookupBusiness(new LookupDataAccess()); List <User> userList = userBusiness.GetUsers(); List <UserModel> userModelList = new List <UserModel>(); foreach (User user in userList) { UserModel userModel = new UserModel { Address = user.Address, CreatedByUserId = user.CreatedByUserId, CreatedDate = user.CreatedDate, DateOfBirth = user.DateOfBirth, EmailId = user.EmailId, FirstName = user.FirstName, Gender = (Enums.Gender)Enum.Parse(typeof(Enums.Gender), lookupBusiness.GetLookupValue(user.GenderId)), LastName = user.LastName, ModifiedByUserId = user.ModifiedByUserId, ModifiedDate = user.ModifiedDate, Password = user.Password, UserId = user.UserId }; userModelList.Add(userModel); } return(View(userModelList)); }
public static object GetSpotRateByFilter(SessionInfo sessioninfo, string processdate, int jtStartIndex, int jtPageSize, string jtSorting) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); //Get data from database List <MA_SPOT_RATE> SpotRates = _lookupbusiness.GetSpotRateByFilter(sessioninfo, processdate, jtSorting); //var jsonData = (from s in SpotRates // select new // { // ID = s.ID, // CurrencyLabel = s.MA_CURRENCY.LABEL, // Proc_date = s.PROC_DATE, // Rate = s.RATE // }).ToList(); //Return result to jTable return(new { Result = "OK", Records = jtPageSize > 0 ? SpotRates.Skip(jtStartIndex).Take(jtPageSize).ToList() : SpotRates, TotalRecordCount = SpotRates.Count }); } catch (BusinessWorkflowsException bex) { return(new { Result = "ERROR", Message = bex.Message }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object GetCurrencyByFilter(SessionInfo sessioninfo, string name, int jtStartIndex, int jtPageSize, string jtSorting) { try { //Return result to jTable LookupBusiness _lookupbusiness = new LookupBusiness(); //Get data from database List <MA_CURRENCY> currencies = _lookupbusiness.GetCurrencyByFilter(sessioninfo, name, jtSorting); //Return result to jTable return(new { Result = "OK", Records = jtPageSize > 0 ? currencies.Skip(jtStartIndex).Take(jtPageSize).ToList() : currencies, TotalRecordCount = currencies.Count }); } catch (BusinessWorkflowsException bex) { return(new { Result = "ERROR", Message = bex.Message }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public ActionResult Create(FormCollection formCollection) { // try // { UserBusiness userBusiness = new UserBusiness(new UserDataAccess()); LookupBusiness lookupBusiness = new LookupBusiness(new LookupDataAccess()); User user = new User { CreatedByUserId = 1, // (int)Session["UserId"]; ModifiedByUserId = 2, // (int)Session["UserId"]; Address = formCollection["Address"], EmailId = formCollection["EmailId"], FirstName = formCollection["FirstName"], LastName = formCollection["LastName"], CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now, DateOfBirth = DateTime.Now, GenderId = lookupBusiness.GetLookupId("Gender", formCollection["Gender"]), Password = formCollection["Password"] }; userBusiness.Create(user); return(RedirectToAction("Index")); //} //catch //{ // return View(); //} }
public DA_TRN CancelDeal(SessionInfo sessioninfo, DA_TRN trn) { LookupBusiness _lookupBusiness = new LookupBusiness(); using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var foundTrn = unitOfWork.DA_TRNRepository.GetById(trn.ID,true); if (foundTrn == null) throw this.CreateException(new Exception(), "Data not found!"); else if (!Guid.Equals(foundTrn.LOG.INSERTBYUSERID, sessioninfo.CurrentUserId)) { throw this.CreateException(new Exception(), "You have no right to cancel this transaction"); } else if (!(foundTrn.ENGINE_DATE.Date == sessioninfo.Process.CurrentDate && foundTrn.SOURCE == "INT")) { throw this.CreateException(new Exception(), "You cannot cancel the past deals"); } else { //foundTrn.STATUS_ID = new Guid("1ccd7506-b98c-4afa-838e-24378d9b3c2e"); foundTrn.REMARK = trn.REMARK; foundTrn.STATUS_ID = _lookupBusiness.GetStatusAll().FirstOrDefault(p => p.LABEL == StatusCode.CANCELLED.ToString()).ID; foundTrn.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId; foundTrn.LOG.MODIFYDATE = DateTime.Now; trn = foundTrn; unitOfWork.Commit(); } } return trn; }
public static List <FIDealModel> GetDealInternalByProcessDate(SessionInfo sessioninfo) { DealBusiness _dealBusiness = new DealBusiness(); UserBusiness _userBusiness = new UserBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); List <MA_CURRENCY> ccys = _lookupBusiness.GetCurrencyAll(); List <MA_USER> users = _userBusiness.GetAll(); Guid productID = _lookupBusiness.GetProductAll().FirstOrDefault(p => p.LABEL == ProductCode.BOND.ToString()).ID; List <DA_TRN> trns = _dealBusiness.GetDealInternalByProcessDate(sessioninfo.Process.CurrentDate); return((from t in trns.Where(a => a.PRODUCT_ID.Value == productID && a.DA_TMBA_EXTENSION != null) join user in users on t.LOG.INSERTBYUSERID equals user.ID into ljuser from inputuser in ljuser.DefaultIfEmpty() join tempccy1 in ccys on t.FIRST.CCY_ID equals tempccy1.ID into ljccy1 from ccy1 in ljccy1.DefaultIfEmpty() join tbmauser in users on t.DA_TMBA_EXTENSION.SENDER_ID equals tbmauser.ID into ljtbmauser from tbmainputuser in ljtbmauser.DefaultIfEmpty() orderby t.LOG.INSERTDATE descending select new FIDealModel { ID = t.ID, DMK_NO = t.INT_DEAL_NO, OPICS_NO = t.EXT_DEAL_NO, InsertState = t.MA_STATUS.LABEL == StatusCode.CANCELLED.ToString() ? "Cancelled" : t.DA_TMBA_EXTENSION.SEND_DATE != null ? "Sent" : 1800 - DateTime.Now.Subtract(t.LOG.INSERTDATE).TotalSeconds <= 0 ? "Late" : (1800 - Math.Round(DateTime.Now.Subtract(t.LOG.INSERTDATE).TotalSeconds)).ToString(), TradeDate = t.TRADE_DATE.Value, MaturityDate = t.MATURITY_DATE, Instrument = t.MA_INSRUMENT.LABEL, BuySell = t.FLAG_BUYSELL, Portfolio = t.MA_PORTFOLIO.LABEL, Counterparty = t.MA_COUTERPARTY.SNAME, Yield = t.FIRST.RATE.Value, GrossValue = t.FIRST.NOTIONAL.Value, CCY = ccy1 != null ? ccy1.LABEL : null, Trader = inputuser != null ? inputuser.USERCODE : null, Status = t.MA_STATUS.LABEL, PCE = t.KK_CONTRIBUTE.HasValue ? t.KK_CONTRIBUTE.Value : 0, Sender = tbmainputuser != null ? tbmainputuser.USERCODE : null, Unit = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.UNIT : 0, CleanPrice = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.CLEAN_PRICE : 0, GrossPrice = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.GROSS_PRICE : 0, YieldType = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.YIELD_TYPE : string.Empty, ReporyBy = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.IS_REPORT_CLEAN ? "Clean Price" : "Gross Price" : string.Empty, Purpose = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.PURPOSE : string.Empty, Term = t.DA_TMBA_EXTENSION != null && t.DA_TMBA_EXTENSION.TERM.HasValue ? t.DA_TMBA_EXTENSION.TERM.Value : 0, Rate = t.DA_TMBA_EXTENSION != null && t.DA_TMBA_EXTENSION.RATE.HasValue ? t.DA_TMBA_EXTENSION.RATE.Value : 0, TBMA_Remark = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.REMARK : string.Empty, SendTime = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.SEND_DATE.HasValue ? t.DA_TMBA_EXTENSION.SEND_DATE.Value.ToString("dd MMM yyy HH:mm") : string.Empty : string.Empty, PrimaryMarket = t.FLAG_PCE.Value ? "Yes" : "No", NonDVP = t.FLAG_SETTLE.Value ? "Yes" : "No" }).ToList()); }
public static MA_TBMA_CONFIG GetTBMAConfig(SessionInfo sessionInfo) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); //Get data from database return(_lookupbusiness.GetTBMAConfig(sessionInfo)); } catch (Exception ex) { throw ex; } }
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 UpdateTBMAConfig(SessionInfo sessioninfo, MA_TBMA_CONFIG record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); var updated = _lookupbusiness.UpdateTBMAConfig(sessioninfo, record); return(new { Result = "OK" }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object UpdateSpotRate(SessionInfo sessioninfo, MA_SPOT_RATE record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); var updated = _lookupbusiness.UpdateSpotRate(sessioninfo, record); return(new { Result = "OK" }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object CreateSpotRate(SessionInfo sessioninfo, MA_SPOT_RATE record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ID = Guid.NewGuid(); var added = _lookupbusiness.CreateSpotRate(sessioninfo, record); return(new { Result = "OK", Record = added }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object UpdateCSAType(SessionInfo sessioninfo, MA_CSA_TYPE record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.LABEL = record.LABEL.ToUpper(); var updated = _lookupbusiness.UpdateCSAType(sessioninfo, record); return(new { Result = "OK" }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object UpdateStatus(SessionInfo sessioninfo, MA_STATUS record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true; record.LABEL = record.LABEL; var updated = _lookupbusiness.UpdateStatus(sessioninfo, record); return(new { Result = "OK" }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object Create(SessionInfo sessioninfo, MA_COUTERPARTY record) { try { CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); MA_CTPY_LIMIT cplimit; record.ID = Guid.NewGuid(); record.SNAME = record.SNAME.ToUpper(); record.TBMA_NAME = record.TBMA_NAME.ToUpper(); record.FNAME = record.FNAME.ToUpper(); record.BUSINESS = record.BUSINESS.ToUpper(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true; record.LOG.INSERTDATE = DateTime.Now; record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId; record.GROUP_CTPY_ID = record.GROUP_CTPY_ID == Guid.Empty ? null : record.GROUP_CTPY_ID; //Prepare Counterparty-Limit data List<MA_LIMIT> limits = _lookupBusiness.GetLimitAll(); foreach (MA_LIMIT limit in limits) { cplimit = new MA_CTPY_LIMIT(); cplimit.ID = Guid.NewGuid(); cplimit.CTPY_ID = record.ID; cplimit.LIMIT_ID = limit.ID; cplimit.FLAG_CONTROL = true; cplimit.AMOUNT = 0; cplimit.EXPIRE_DATE = sessioninfo.Process.CurrentDate; cplimit.LOG.INSERTDATE = DateTime.Now; cplimit.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId; record.MA_CTPY_LIMIT.Add(cplimit); } var addedRecord = _counterpartyBusiness.Create(sessioninfo, record); addedRecord.MA_CTPY_LIMIT.Clear(); return new { Result = "OK", Record = addedRecord }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object Create(SessionInfo sessioninfo, MA_COUTERPARTY record) { try { CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); MA_CTPY_LIMIT cplimit; record.ID = Guid.NewGuid(); record.SNAME = record.SNAME.ToUpper(); record.TBMA_NAME = record.TBMA_NAME.ToUpper(); record.FNAME = record.FNAME.ToUpper(); record.BUSINESS = record.BUSINESS.ToUpper(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true; record.LOG.INSERTDATE = DateTime.Now; record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId; record.GROUP_CTPY_ID = record.GROUP_CTPY_ID == Guid.Empty ? null : record.GROUP_CTPY_ID; //Prepare Counterparty-Limit data List <MA_LIMIT> limits = _lookupBusiness.GetLimitAll(); foreach (MA_LIMIT limit in limits) { cplimit = new MA_CTPY_LIMIT(); cplimit.ID = Guid.NewGuid(); cplimit.CTPY_ID = record.ID; cplimit.LIMIT_ID = limit.ID; cplimit.FLAG_CONTROL = true; cplimit.AMOUNT = 0; cplimit.EXPIRE_DATE = sessioninfo.Process.CurrentDate; cplimit.LOG.INSERTDATE = DateTime.Now; cplimit.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId; record.MA_CTPY_LIMIT.Add(cplimit); } var addedRecord = _counterpartyBusiness.Create(sessioninfo, record); addedRecord.MA_CTPY_LIMIT.Clear(); return(new { Result = "OK", Record = addedRecord }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object CreateCurrency(SessionInfo sessioninfo, MA_CURRENCY record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ID = Guid.NewGuid(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true; record.LABEL = record.LABEL.ToUpper(); var added = _lookupbusiness.CreateCurrency(sessioninfo, record); return(new { Result = "OK", Record = added }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object UpdateBondMarket(SessionInfo sessioninfo, MA_BOND_MARKET record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.LABEL = record.LABEL.ToUpper(); record.DESCRIPTION = record.DESCRIPTION.ToUpper(); var updated = _lookupbusiness.UpdateBondMarket(sessioninfo, record); return(new { Result = "OK" }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object CreateCurrency(SessionInfo sessioninfo, MA_CURRENCY record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ID = Guid.NewGuid(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true; record.LABEL = record.LABEL.ToUpper(); var added = _lookupbusiness.CreateCurrency(sessioninfo, record); return new { Result = "OK", Record = added }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetCSATypeOptions(SessionInfo sessioninfo) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var csa = _lookupBusiness.GetCSATypeAll().Select(c => new { DisplayText = c.LABEL, Value = c.ID }); //Return result to jTable return(new { Result = "OK", Options = csa }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
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 CreatePortfolio(SessionInfo sessioninfo, MA_PORTFOLIO record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ID = Guid.NewGuid(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true; record.ISDEFAULT = record.ISDEFAULT == null || !record.ISDEFAULT.Value ? false : true; record.LABEL = record.LABEL; var added = _lookupbusiness.CreateProfolio(sessioninfo, record); return(new { Result = "OK", Record = added }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
private void Initialize() { Session["OldPasswords"] = new List <string> { "Password@1", "Password@2", "Password@3" }; rdoCountry.DataSource = LookupBusiness.GetCountries(); rdoCountry.DataValueField = "Code"; rdoCountry.DataTextField = "Value"; rdoCountry.DataBind(); Candidate candidate = Session["Candidate"] as Candidate; if (candidate != null) { rdoCountry.SelectedValue = candidate.CountryCode.ToString(); rdoStates.DataSource = LookupBusiness.GetStates(candidate.CountryCode); rdoStates.DataValueField = "StateID"; rdoStates.DataTextField = "StateName"; rdoStates.DataBind(); rdoStates.SelectedValue = candidate.StateID.ToString(); txtFirstName.Text = candidate.FirstName; txtLastName.Text = candidate.LastName; txtEmailID.Text = candidate.EmailID; txtAlternateEmailID.Text = candidate.AlternateEmailID; ddlCandidateStatus.SelectedValue = candidate.CandidateStatus; txtPhoneHome.Text = candidate.PhoneHome; txtPhoneCell.Text = candidate.PhoneCell; txtPhoneWork.Text = candidate.PhoneWork; txtAddress1.Text = candidate.Address1; txtAddress2.Text = candidate.Address2; txtCity.Text = candidate.City; txtZipCode.Text = candidate.ZipCode; hdnCountryCode.Value = candidate.CountryCode.ToString(); hdnCountryValue.Value = candidate.CountryValue; hdnStateID.Value = candidate.StateID.ToString(); hdnStateName.Value = candidate.StateName.ToString(); } }
public static object CreateBondMarket(SessionInfo sessioninfo, MA_BOND_MARKET record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ID = Guid.NewGuid(); record.LABEL = record.LABEL.ToUpper(); record.DESCRIPTION = record.DESCRIPTION.ToUpper(); var added = _lookupbusiness.CreateBondMarket(sessioninfo, record); return new { Result = "OK", Record = added }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetPortfolioOptions(SessionInfo sessioninfo) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var portfolio = _lookupBusiness.GetPortfolioAll().Where(t => t.ISACTIVE == true).OrderBy(p => p.LABEL) .Select(c => new { DisplayText = c.LABEL, Value = c.ID, Default = c.ISDEFAULT }); //Return result to jTable return(new { Result = "OK", Options = portfolio }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object UpdateLimit(SessionInfo sessioninfo, MA_LIMIT record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE ? false : true; record.LABEL = record.LABEL; record.LIMIT_TYPE = record.LIMIT_TYPE; record.INDEX = record.INDEX; var updated = _lookupbusiness.UpdateLimit(sessioninfo, record); return(new { Result = "OK" }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object CreateCSAType(SessionInfo sessioninfo, MA_CSA_TYPE record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ID = Guid.NewGuid(); record.LABEL = record.LABEL.ToUpper(); record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId; record.LOG.INSERTDATE = DateTime.Now; var added = _lookupbusiness.CreateCSAType(sessioninfo, record); return(new { Result = "OK", Record = added }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object GetCurrencyOptions(SessionInfo sessioninfo) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var currencies = _lookupBusiness.GetCurrencyAll().Select(c => new { DisplayText = c.LABEL, Value = c.ID.ToString() }); var currenciesList = currencies.ToList(); currenciesList.Insert(0, new { DisplayText = "Please select", Value = string.Empty }); //Return result to jTable return(new { Result = "OK", Options = currenciesList }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object UpdateFreqType(SessionInfo sessioninfo, MA_FREQ_TYPE record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true; //record.LABEL = record.LABEL; //record.USERCODE = record record.USERCODE = record.USERCODE; record.INDEX = record.INDEX; var updated = _lookupbusiness.UpdateFreqType(sessioninfo, record); return(new { Result = "OK" }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object CreateCSAType(SessionInfo sessioninfo, MA_CSA_TYPE record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ID = Guid.NewGuid(); record.LABEL = record.LABEL.ToUpper(); record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId; record.LOG.INSERTDATE = DateTime.Now; var added = _lookupbusiness.CreateCSAType(sessioninfo, record); return new { Result = "OK", Record = added }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetBondMarketOptions(SessionInfo sessioninfo) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var bondMarkets = _lookupBusiness.GetBondMarketAll().Select(c => new { DisplayText = c.LABEL, Value = c.ID.ToString() }).OrderBy(p => p.DisplayText); var bondMarketsList = bondMarkets.ToList(); bondMarketsList.Insert(0, new { DisplayText = "Please select...", Value = string.Empty }); //Return result to jTable return(new { Result = "OK", Options = bondMarketsList }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object CreateFreqType(SessionInfo sessioninfo, MA_FREQ_TYPE record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ID = Guid.NewGuid(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true; record.LABEL = record.LABEL; record.USERCODE = record.USERCODE; record.INDEX = record.INDEX; var added = _lookupbusiness.CreateFreqType(sessioninfo, record); return new { Result = "OK", Record = added }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object SendFIReport(SessionInfo sessioninfo, string IDs) { try { string[] TrnsID = IDs.Split(','); DealBusiness _dealBusiness = new DealBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); MA_TBMA_CONFIG config = _lookupBusiness.GetTBMAConfig(sessioninfo); Guid productID = _lookupBusiness.GetProductAll().FirstOrDefault(p => p.LABEL == ProductCode.BOND.ToString()).ID; List <DA_TRN> trns = _dealBusiness.GetDealInternalByProcessDate(sessioninfo.Process.CurrentDate) .Where(a => a.PRODUCT_ID.Value == productID && TrnsID.Contains(a.ID.ToString()) && a.DA_TMBA_EXTENSION.SEND_DATE == null).ToList(); var validateTBMA_NAME = (from o1 in trns where string.IsNullOrEmpty(o1.MA_COUTERPARTY.TBMA_NAME) select o1.MA_COUTERPARTY.SNAME).Distinct().ToArray(); //verify required info if (validateTBMA_NAME.Length > 0) { throw CreateException(new Exception(), "TBMA_NAME can't be empty. Please input TBMA_NAME on counterparty " + string.Join(",", validateTBMA_NAME)); } if (config == null) { throw CreateException(new Exception(), "Cannot get configurations. Please contact administrator"); } foreach (DA_TRN trn in trns) { _dealBusiness.CreatingTBMAReportFile(sessioninfo, trn, config); } Guid[] TrnsIDSend = trns.Select(t => t.ID).ToArray(); _dealBusiness.UpdateFISendReport(sessioninfo, TrnsIDSend); return(new { Result = "OK", Message = String.Format("Sending report completed") }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object GetCSAByCtpyID(SessionInfo sessioninfo, Guid ID) { try { CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database List <CSAAgreementModel> results = new List <CSAAgreementModel>(); var csa = _counterpartyBusiness.GetCSAByCtpyID(sessioninfo, ID); var products = _lookupBusiness.GetProductAll(); if (csa != null) { var csaproduct = from c in csa.MA_CSA_PRODUCT join product in products on c.PRODUCT_ID equals product.ID select new { LABEL = product.LABEL }; CSAAgreementModel ca = new CSAAgreementModel(); ca.CSA_TYPE_ID = csa.CSA_TYPE_ID; ca.ID = csa.ID; ca.ISACTIVE = csa.ISACTIVE; ca.PRODUCTS = String.Join(",", csaproduct.Select(p => p.LABEL)); results.Add(ca); } //Return result to jTable return(new { Result = "OK", Records = results, TotalRecordCount = results.Count }); } catch (BusinessWorkflowsException bex) { return(new { Result = "ERROR", Message = bex.Message }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
// GET: Elevator/Edit/5 public ActionResult Edit(int id) { ElevatorBusiness elevatorBusiness = new ElevatorBusiness(new ElevatorDataAccess()); LookupBusiness lookupBusiness = new LookupBusiness(new LookupDataAccess()); ElevatorCoreModel.Elevator elevator = elevatorBusiness.GetElevator(id); ElevatorModel elevatorModel = new ElevatorModel { ElevatorName = elevator.ElevatorName, CreatedByUserId = elevator.CreatedByUserId, MainStatus = (Enums.MainStatus)Enum.Parse(typeof(Enums.MainStatus), lookupBusiness.GetLookupValue(elevator.MainStatusId)), ModifiedByUserId = elevator.ModifiedByUserId, ModifiedDate = elevator.ModifiedDate, MaxWeight = elevator.MaxWeight, FloorDuration = elevator.FloorDuration, CreatedDate = elevator.CreatedDate, ElevatorId = elevator.ElevatorId }; return(View(elevatorModel)); }
public static object GetProductOptions(SessionInfo sessioninfo, string except_product = "") { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var products = _lookupBusiness.GetProductAll().Where(t => t.ISACTIVE == true); if (except_product != "") { products = products.Where(p => p.LABEL != except_product); } //Return result to jTable return(new { Result = "OK", Options = products.OrderBy(t => t.LABEL).Select(c => new { DisplayText = c.LABEL, Value = c.ID }) }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
// GET: Elevator public ActionResult Index() { ElevatorBusiness elevatorBusiness = new ElevatorBusiness(new ElevatorDataAccess()); LookupBusiness lookupBusiness = new LookupBusiness(new LookupDataAccess()); List <ElevatorCoreModel.Elevator> elevatorList = elevatorBusiness.GetElevators(); List <ElevatorModel> elevatorModelList = new List <ElevatorModel>(); foreach (var elevator in elevatorList) { ElevatorModel elevatorModel = new ElevatorModel { ElevatorId = elevator.ElevatorId, ElevatorName = elevator.ElevatorName, FloorDuration = elevator.FloorDuration, MaxWeight = elevator.MaxWeight, MainStatus = (Enums.MainStatus)Enum.Parse(typeof(Enums.MainStatus), lookupBusiness.GetLookupValue(elevator.MainStatusId)), }; elevatorModelList.Add(elevatorModel); } return(View(elevatorModelList)); }
public static object GetCurrencyOptions(SessionInfo sessioninfo) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var currencies = _lookupBusiness.GetCurrencyAll().Select(c => new { DisplayText = c.LABEL, Value = c.ID.ToString() }); var currenciesList = currencies.ToList(); currenciesList.Insert(0, new { DisplayText = "Please select", Value = string.Empty }); //Return result to jTable return new { Result = "OK", Options = currenciesList }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static MA_TBMA_CONFIG GetTBMAConfig(SessionInfo sessionInfo) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); //Get data from database return _lookupbusiness.GetTBMAConfig(sessionInfo); } catch (Exception ex) { throw ex; } }
public static object GetPortfolioOptions(SessionInfo sessioninfo) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var portfolio = _lookupBusiness.GetPortfolioAll().Where(t => t.ISACTIVE == true).OrderBy(p => p.LABEL) .Select(c => new { DisplayText = c.LABEL, Value = c.ID, Default = c.ISDEFAULT }); //Return result to jTable return new { Result = "OK", Options = portfolio }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetFreqTypeOptions(SessionInfo sessioninfo) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var freqtypes = _lookupBusiness.GetFreqTypeAll().OrderBy(p => p.INDEX).Select(c => new { DisplayText = c.LABEL, Value = c.ID }); //Return result to jTable return new { Result = "OK", Options = freqtypes }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object CreatePortfolio(SessionInfo sessioninfo, MA_PORTFOLIO record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ID = Guid.NewGuid(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true; record.ISDEFAULT = record.ISDEFAULT == null || !record.ISDEFAULT.Value ? false : true; record.LABEL = record.LABEL; var added = _lookupbusiness.CreateProfolio(sessioninfo, record); return new { Result = "OK", Record = added }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static List<DealViewModel> GetPCEDetailData(SessionInfo sessioninfo, string strReportDate, string strCtpy, string strProduct, string strSource) { try { ReportBusiness _reportBusiness = new ReportBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); CountryBusiness _countryBusiness = new CountryBusiness(); CounterpartyBusiness _ctpyBusiness = new CounterpartyBusiness(); List<DA_TRN> trns = _reportBusiness.GetPCEDetailReport(sessioninfo, strReportDate, strCtpy, strProduct, strSource); List<MA_CURRENCY> ccys = _lookupBusiness.GetCurrencyAll(); List<MA_CSA_PRODUCT> csaproducts = _ctpyBusiness.GetCSAProductAll(sessioninfo); List<MA_COUNTRY> country = _countryBusiness.GetCountryAll(); var report = (from trn in trns join ct in country on trn.MA_COUTERPARTY.COUNTRY_ID equals ct.ID join ccy1 in ccys on trn.FIRST.CCY_ID equals ccy1.ID into ljccy1 from subccy1 in ljccy1.DefaultIfEmpty() join ccy2 in ccys on trn.SECOND.CCY_ID equals ccy2.ID into ljccy2 from subccy2 in ljccy2.DefaultIfEmpty() join csaproduct in csaproducts on new { CTPY_ID = trn.CTPY_ID, PRODUCT_ID = trn.PRODUCT_ID.Value } equals new { CTPY_ID = csaproduct.CSA_AGREEMENT_ID, PRODUCT_ID = csaproduct.PRODUCT_ID } into ljcsa from subcsa in ljcsa.DefaultIfEmpty() select new DealViewModel { EngineDate = trn.ENGINE_DATE, DMK_NO = trn.INT_DEAL_NO, OPICS_NO = trn.EXT_DEAL_NO, Source = trn.SOURCE == "INT" ? "DMK" : "OPICS", Product = trn.MA_PRODUCT.LABEL, Portfolio = trn.MA_PORTFOLIO.LABEL, TradeDate = trn.TRADE_DATE.Value, EffectiveDate = trn.START_DATE, MaturityDate = trn.MATURITY_DATE, Instrument = trn.MA_INSRUMENT.LABEL, Counterparty = trn.MA_COUTERPARTY.SNAME, Notional1 = trn.FIRST.NOTIONAL, Notional2 = trn.SECOND.NOTIONAL, FixedFloat1 = !trn.FIRST.FLAG_FIXED.HasValue ? "-" : trn.FIRST.FLAG_FIXED.Value ? trn.FIRST.FLAG_PAYREC + "-FIXED" : trn.FIRST.FLAG_PAYREC + "-FLOAT", FixedFloat2 = !trn.SECOND.FLAG_FIXED.HasValue ? "-" : trn.SECOND.FLAG_FIXED.Value ? trn.SECOND.FLAG_PAYREC + "-FIXED" : trn.SECOND.FLAG_PAYREC + "-FLOAT", KKPCCF = trn.KK_PCCF, KKContribute = trn.KK_CONTRIBUTE, CCY1 = subccy1 != null ? subccy1.LABEL : "-", CCY2 = subccy2 != null ? subccy2.LABEL : "-", CSA = subcsa != null ? "Yes" : "No", Country = ct.LABEL }).OrderBy(p => p.DMK_NO).ToList(); return report; } catch (Exception ex) { throw ex; } }
public static object CreateSpotRate(SessionInfo sessioninfo, MA_SPOT_RATE record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ID = Guid.NewGuid(); var added = _lookupbusiness.CreateSpotRate(sessioninfo, record); return new { Result = "OK", Record = added }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object CancelDeal(SessionInfo sessioninfo, DA_TRN trn) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); UserBusiness _userBusiness = new UserBusiness(); DealBusiness _dealbusiness = new DealBusiness(); DA_TRN t = _dealbusiness.CancelDeal(sessioninfo, trn); DA_TRN t2 = _dealbusiness.GetDealByDealNo(t.INT_DEAL_NO,t.VERSION).FirstOrDefault(p => p.ID != t.ID); if (t2 != null) _dealbusiness.CancelDeal(sessioninfo, t2); var inputuser = _userBusiness.GetAll().FirstOrDefault(u => u.ID == t.LOG.INSERTBYUSERID); var query = new DealViewModel { ID = t.ID, EntryDate = t.LOG.INSERTDATE, DMK_NO = t.INT_DEAL_NO , OPICS_NO = t.EXT_DEAL_NO, TradeDate = t.TRADE_DATE.Value , EffectiveDate = t.START_DATE, Instrument = t.MA_INSRUMENT.LABEL , MaturityDate = t.MATURITY_DATE, BuySell = t.FLAG_BUYSELL , Product = t.MA_PRODUCT.LABEL, Portfolio = t.MA_PORTFOLIO.LABEL , Counterparty = t.MA_COUTERPARTY.SNAME, Notional1 = t.FIRST.NOTIONAL , PayRec1 = t.FIRST.FLAG_PAYREC, FixedFloat1 = !t.FIRST.FLAG_FIXED.HasValue ? null : t.FIRST.FLAG_FIXED.Value ? "FIXED" : "FLOAT" , Rate1 = t.FIRST.RATE, Fixing1 = t.FIRST.FIRSTFIXINGAMT, SwapPoint1 = t.FIRST.SWAP_POINT, Notional2 = t.SECOND.NOTIONAL , PayRec2 = t.SECOND.FLAG_PAYREC, FixedFloat2 = !t.SECOND.FLAG_FIXED.HasValue ? null : t.SECOND.FLAG_FIXED == true ? "FIXED" : "FLOAT" , Rate2 = t.SECOND.RATE, Fixing2 = t.SECOND.FIRSTFIXINGAMT, SwapPoint2 = t.SECOND.SWAP_POINT, Status = _lookupBusiness.GetStatusAll().FirstOrDefault(p => p.ID == t.STATUS_ID).LABEL , KKContribute = t.KK_CONTRIBUTE, BotContribute = t.BOT_CONTRIBUTE , LimitOverwrite = string.IsNullOrEmpty(t.OVER_APPROVER) ? "No" : t.OVER_AMOUNT > 0 && t.OVER_SETTL_AMOUNT > 0 ? "Yes" : t.OVER_AMOUNT > 0 ? "PCE" : "SET" , LimitApprover = t.OVER_APPROVER , Trader = inputuser != null ? inputuser.USERCODE : "" , Remark = t.REMARK }; return new { Result = "OK", Record = query, DealPairID = t2 != null? t2.ID.ToString() : string.Empty }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetTBMAConfigAll(SessionInfo sessionInfo) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); //Get data from database List<MA_TBMA_CONFIG> config = _lookupbusiness.GetTBMAConfigAll(sessionInfo); return new { Result = "OK", Records = config, TotalRecordCount = 1 }; } catch (BusinessWorkflowsException bex) { return new { Result = "ERROR", Message = bex.Message }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetCSATypeByFilter(SessionInfo sessionInfo, string label, int jtStartIndex, int jtPageSize, string jtSorting) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); //Get data from database List<MA_CSA_TYPE> market = _lookupbusiness.GetCSATypeByFilter(sessionInfo, label, jtSorting); return new { Result = "OK", Records = jtPageSize > 0 ? market.Skip(jtStartIndex).Take(jtPageSize).ToList() : market, TotalRecordCount = market.Count }; } catch (BusinessWorkflowsException bex) { return new { Result = "ERROR", Message = bex.Message }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object UpdateCSAType(SessionInfo sessioninfo, MA_CSA_TYPE record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.LABEL = record.LABEL.ToUpper(); var updated = _lookupbusiness.UpdateCSAType(sessioninfo, record); return new { Result = "OK" }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object UpdateLimit(SessionInfo sessioninfo, MA_LIMIT record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE ? false : true; record.LABEL = record.LABEL; record.LIMIT_TYPE = record.LIMIT_TYPE; record.INDEX = record.INDEX; var updated = _lookupbusiness.UpdateLimit(sessioninfo, record); return new { Result = "OK" }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object UpdateSpotRate(SessionInfo sessioninfo, MA_SPOT_RATE record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); var updated = _lookupbusiness.UpdateSpotRate(sessioninfo, record); return new { Result = "OK" }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object UpdateStatus(SessionInfo sessioninfo, MA_STATUS record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true; record.LABEL = record.LABEL; var updated = _lookupbusiness.UpdateStatus(sessioninfo, record); return new { Result = "OK" }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object UpdateTBMAConfig(SessionInfo sessioninfo, MA_TBMA_CONFIG record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); var updated = _lookupbusiness.UpdateTBMAConfig(sessioninfo, record); return new { Result = "OK" }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetBondMarketOptions(SessionInfo sessioninfo) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var bondMarkets = _lookupBusiness.GetBondMarketAll().Select(c => new { DisplayText = c.LABEL, Value = c.ID.ToString() }).OrderBy(p => p.DisplayText); var bondMarketsList = bondMarkets.ToList(); bondMarketsList.Insert(0, new { DisplayText = "Please select...", Value = string.Empty }); //Return result to jTable return new { Result = "OK", Options = bondMarketsList }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetStatusOptions(SessionInfo sessioninfo) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var products = _lookupBusiness.GetStatusAll().Select(c => new { DisplayText = c.LABEL, Value = c.ID }); //Return result to jTable return new { Result = "OK", Options = products }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static List<DealViewModel> GetDealInquiryData(SessionInfo sessioninfo , string strDMKNo , string strOPICNo , string strProduct , string strCtpy , string strPortfolio , string strTradeDate , string strEffDate , string strMatDate , string strInstrument , string strUser , string strStatus , string strOverStatus , string strProcDate , string strSettleStatus) { DealBusiness _dealBusiness = new DealBusiness(); UserBusiness _userBusiness = new UserBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database List<DA_TRN> trns = _dealBusiness.GetDealInquiryByFilter(sessioninfo , strDMKNo , strOPICNo , strProduct , strCtpy , strPortfolio , strTradeDate , strEffDate , strMatDate , strInstrument , strUser , strStatus , strProcDate); //Get user data List<MA_USER> users = _userBusiness.GetAll(); List<MA_CURRENCY> ccys = _lookupBusiness.GetCurrencyAll(); List<MA_FREQ_TYPE> freq = _lookupBusiness.GetFreqTypeAll(); return (from t in trns join user in users on t.LOG.INSERTBYUSERID equals user.ID into ljuser from inputuser in ljuser.DefaultIfEmpty() join tempccy1 in ccys on t.FIRST.CCY_ID equals tempccy1.ID into ljccy1 from ccy1 in ljccy1.DefaultIfEmpty() join tempccy2 in ccys on t.SECOND.CCY_ID equals tempccy2.ID into ljccy2 from ccy2 in ljccy2.DefaultIfEmpty() join f1 in freq on t.FIRST.FREQTYPE_ID equals f1.ID into fg1 from subfg1 in fg1.DefaultIfEmpty() join f2 in freq on t.SECOND.FREQTYPE_ID equals f2.ID into fg2 from subfg2 in fg2.DefaultIfEmpty() select new DealViewModel { ID = t.ID, EntryDate = t.LOG.INSERTDATE, DMK_NO = t.INT_DEAL_NO, OPICS_NO = t.EXT_DEAL_NO, TradeDate = t.TRADE_DATE.Value, EffectiveDate = t.START_DATE, Instrument = t.MA_INSRUMENT.LABEL, MaturityDate = t.MATURITY_DATE, BuySell = t.FLAG_BUYSELL, Product = t.MA_PRODUCT.LABEL, Portfolio = t.MA_PORTFOLIO.LABEL, Counterparty = t.MA_COUTERPARTY.SNAME, Notional1 = t.FIRST.NOTIONAL, PayRec1 = t.FIRST.FLAG_PAYREC, FixedFloat1 = !t.FIRST.FLAG_FIXED.HasValue ? null : t.FIRST.FLAG_FIXED.Value ? "FIXED" : "FLOAT", Rate1 = t.FIRST.RATE, Fixing1 = t.FIRST.FIRSTFIXINGAMT, SwapPoint1 = t.FIRST.SWAP_POINT, Notional2 = t.SECOND.NOTIONAL, PayRec2 = t.SECOND.FLAG_PAYREC, FixedFloat2 = !t.SECOND.FLAG_FIXED.HasValue ? null : t.SECOND.FLAG_FIXED == true ? "FIXED" : "FLOAT", Rate2 = t.SECOND.RATE, Fixing2 = t.SECOND.FIRSTFIXINGAMT, SwapPoint2 = t.SECOND.SWAP_POINT, Status = t.MA_STATUS.LABEL, KKContribute = t.KK_CONTRIBUTE, BotContribute = t.BOT_CONTRIBUTE , LimitOverwrite = string.IsNullOrEmpty(t.OVER_APPROVER) ? "No" : t.OVER_AMOUNT > 0 && t.OVER_SETTL_AMOUNT > 0 ? "Yes" : t.OVER_AMOUNT > 0 ? "PCE" : "SET", LimitApprover = t.OVER_APPROVER, Trader = inputuser != null ? inputuser.USERCODE : null, Remark = t.REMARK, CCY1 = ccy1 != null ? ccy1.LABEL : null, CCY2 = ccy2 != null ? ccy2.LABEL : null, SettlementLimit = !t.FLAG_SETTLE.HasValue || !t.FLAG_SETTLE.Value ? "No" : "Yes", Freq1 = subfg1 != null ? subfg1.USERCODE : null, Freq2 = subfg2 != null ? subfg2.USERCODE : null, OpicsTrader = t.INSERT_BY_EXT, TBMA_SENT = t.DA_TMBA_EXTENSION == null ? "N/A" : t.DA_TMBA_EXTENSION.SEND_DATE != null ? "Yes" : "No" }).Where(p => p.LimitOverwrite == strOverStatus || String.IsNullOrEmpty(strOverStatus)) .Where(t => t.SettlementLimit == strSettleStatus || string.IsNullOrEmpty(strSettleStatus)).ToList(); }
public static object GetStatusByFilter(SessionInfo sessioninfo, string name, int jtStartIndex, int jtPageSize, string jtSorting) { try { //Return result to jTable LookupBusiness _lookupbusiness = new LookupBusiness(); //Get data from database List<MA_STATUS> status = _lookupbusiness.GetStatusByFilter(sessioninfo, name, jtSorting); //Return result to jTable return new { Result = "OK", Records = jtPageSize > 0 ? status.Skip(jtStartIndex).Take(jtPageSize).ToList() : status, TotalRecordCount = status.Count }; } catch (BusinessWorkflowsException bex) { return new { Result = "ERROR", Message = bex.Message }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetSpotRateByFilter(SessionInfo sessioninfo, string processdate, int jtStartIndex, int jtPageSize, string jtSorting) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); //Get data from database List<MA_SPOT_RATE> SpotRates = _lookupbusiness.GetSpotRateByFilter(sessioninfo, processdate, jtSorting); //var jsonData = (from s in SpotRates // select new // { // ID = s.ID, // CurrencyLabel = s.MA_CURRENCY.LABEL, // Proc_date = s.PROC_DATE, // Rate = s.RATE // }).ToList(); //Return result to jTable return new { Result = "OK", Records = jtPageSize > 0 ? SpotRates.Skip(jtStartIndex).Take(jtPageSize).ToList() : SpotRates, TotalRecordCount = SpotRates.Count }; } catch (BusinessWorkflowsException bex) { return new { Result = "ERROR", Message = bex.Message }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetProductOptions(SessionInfo sessioninfo, string except_product = "") { try { LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database var products = _lookupBusiness.GetProductAll().Where(t => t.ISACTIVE == true); if (except_product != "") { products = products.Where(p => p.LABEL != except_product); } //Return result to jTable return new { Result = "OK", Options = products.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 List<DealViewModel> GetLimitOverwriteData(SessionInfo sessioninfo, string strReportDate, string strCtpy) { ReportBusiness _reportBusiness = new ReportBusiness(); UserBusiness _userBusiness = new UserBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); char[] trimchar = { '/' }; List<DA_TRN> trns = _reportBusiness.GetLimitOverwriteReport(sessioninfo,strReportDate,strCtpy); List<MA_USER> users = _userBusiness.GetAll(); List<MA_CURRENCY> ccys = _lookupBusiness.GetCurrencyAll(); var query = (from t in trns join user in users on t.LOG.INSERTBYUSERID equals user.ID into ljuser join ccy in ccys on t.FIRST.CCY_ID equals ccy.ID from inputuser in ljuser.DefaultIfEmpty() select new DealViewModel { EngineDate = t.ENGINE_DATE, Trader = inputuser != null ? inputuser.USERCODE : "", LimitApprover = t.OVER_APPROVER, Remark = t.OVER_COMMENT, DMK_NO = t.INT_DEAL_NO, Counterparty = t.MA_COUTERPARTY.SNAME, Product = t.MA_PRODUCT.LABEL, Instrument = t.MA_INSRUMENT.LABEL, Notional1 = t.FIRST.NOTIONAL, CCY1 = ccy.LABEL, KKContribute = t.KK_CONTRIBUTE, LimitOverwrite = string.Concat(t.OVER_AMOUNT > 0 ? "PCE/" : "", t.OVER_SETTL_AMOUNT > 0 ? "SET/" : "", t.OVER_COUNTRY_AMOUNT > 0 ? "COUNTRY/" : "").TrimEnd(trimchar), LimitOverAmount = ((t.OVER_AMOUNT > 0 ? "PCE: " + t.OVER_AMOUNT.Value.ToString("#,##0") : string.Empty) + (t.OVER_SETTL_AMOUNT > 0 ? " SET: " + t.OVER_SETTL_AMOUNT.Value.ToString("#,##0") : string.Empty) + (t.OVER_COUNTRY_AMOUNT > 0 ? " COUNTRY: " + t.OVER_COUNTRY_AMOUNT.Value.ToString("#,##0") : string.Empty)).Trim() }).OrderBy(t=>t.EngineDate).ToList(); return query; }
public static List<LimitAuditReportModel> GetLimitAuditExport(SessionInfo sessioninfo, string strLogDatefrom, string strLogDateto, string strCtpy, string strCountry, string strEvent) { ReportBusiness _reportBusiness = new ReportBusiness(); CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); UserBusiness _userBusiness = new UserBusiness(); List<LimitAuditReportModel> logs = _reportBusiness.GetLimitAuditReport(sessioninfo, strLogDatefrom, strLogDateto, strCtpy, strCountry, strEvent); return logs; }