public void UnsubscribeTrading() { TradingRequest tr = new TradingRequest { Channel = ChannelType.Trading, Action = ActionType.Unsubscribe }; AddMessageToQueue(tr); }
public HttpResponseMessage ProcessRequest([FromBody] TradingRequest tr, TradingType type) { var cmd = new TradingRecord( tr.Symbol.ToUpper(), tr.Quantity, tr.Price, type); var result = Validation.Validation.tradingdValidation.Invoke(cmd).ToResult(); Publish(tr.ConnectionID, result); return(ToResponse(this.Request, result)); }
public ActionResult AjaxUpdateOrder() { #region Form参数 string ticketID = System.Web.HttpContext.Current.Request.Form["TicketID"]; string followID = System.Web.HttpContext.Current.Request.Form["FollowID"]; string BankName = System.Web.HttpContext.Current.Request.Form["BankName"]; string ProvinceID = System.Web.HttpContext.Current.Request.Form["ProvinceID"]; string CityID = System.Web.HttpContext.Current.Request.Form["CityID"]; string TicketType = System.Web.HttpContext.Current.Request.Form["TicketType"]; string BankTyp = System.Web.HttpContext.Current.Request.Form["BankTyp"]; string TicketEndTime = System.Web.HttpContext.Current.Request.Form["TicketEndTime"]; string auditState = System.Web.HttpContext.Current.Request.Form["AuditState"]; string AuditNote = System.Web.HttpContext.Current.Request.Form["AuditNote"]; string UserNote = System.Web.HttpContext.Current.Request.Form["UserNote"]; #endregion try { TicketDiscount model = db.TicketDiscount.Where(t => t.TicketID == Convert.ToInt32(ticketID)).FirstOrDefault(); UpdateModel(model);//修改模型必须在此之后 #region 编辑信息 model.TicketCategory = StaticDictiory.getCategory(Convert.ToInt32(TicketType), model.TicketPrice); model.TermType = StaticDictiory.getTerm(Convert.ToInt32(TicketType), (int)model.TicketCategory, Convert.ToDateTime(Convert.ToDateTime(model.PublishTime).ToString("yyyy-MM-dd 23:59:59"))); model.TicketEndTime = Convert.ToDateTime(Convert.ToDateTime(TicketEndTime).ToString("yyyy-MM-dd 23:59:59")); model.AuditTime = DateTime.Now; model.AuditorID = 0; model.BankName = BankName; model.ProvinceID = ProvinceID; model.CityID = CityID; model.TicketType = Convert.ToInt32(TicketType); model.BankType = Convert.ToInt32(BankTyp); model.AuditState = Convert.ToInt32(auditState); model.AuditNote = AuditNote; model.UserNote = UserNote; #endregion if (auditState == AuditState.审核通过.ToString()) { #region 通过 #region MyRegion model.AuditorName = "BBBBBBB"; model.TradeState = (int)TradeState.交易完成; Random ran = new Random(); model.YykbTime = DateTime.Now; model.JjzTime = DateTime.Now; model.QryyTime = DateTime.Now.AddMinutes(ran.Next(5, 8)).AddSeconds(ran.Next(0, 59)); model.ZfdjTime = DateTime.Now.AddMinutes(ran.Next(9, 11)).AddSeconds(ran.Next(0, 59)); model.CprbsTime = DateTime.Now.AddMinutes(ran.Next(12, 14)).AddSeconds(ran.Next(0, 59)); model.QsjdTime = DateTime.Now.AddMinutes(ran.Next(15, 17)).AddSeconds(ran.Next(0, 59)); model.WcjyTime = DateTime.Now.AddMinutes(ran.Next(18, 22)).AddSeconds(ran.Next(0, 59)); #endregion #region MyRegion var bidmodel = db.DiscountBidding; DiscountBidding biding = new DiscountBidding(); biding.TicketID = model.TicketID; biding.BidUserID = (Int32)model.BidId; biding.BidTime = DateTime.Now.AddMinutes(ran.Next(2, 8)); biding.BidResult = 1; biding.BidRelateResult = 1; biding.LoginMode = 1; biding.TotalPrice = model.BidPrice; //(price - parseFloat(inputQuote.val().replace(/,/ig, ''))) * 100000 / price, //biding.BidPrice = (decimal)((model.TicketPrice - model.BidPrice) * 100000 / model.TicketPrice); biding.BidPrice = (decimal)((model.TicketPrice - model.BidPrice) / model.TicketPrice); //(30 * per10 / days / 100) * 10 / 12; Decimal mony = (Decimal)(model.TicketPrice - model.BidPrice); //利息 int sjdays = RestDays(model.TicketEndTime); //实际天数 Decimal bidrate = sjdays <= 0 ? 0 : mony * 360 * 100 / (model.TicketPrice * sjdays); //例如3.17% biding.BidRate = bidrate; bidmodel.Add(biding); #endregion #region MyRegion //ClientUser client=db.ClientUser.Where(u=>u.ID== model.UserID) var client = (from cu in db.ClientUser join uc in db.UserCenter on cu.ID equals uc.ID join pro in db.SysStatic on cu.ProvinceID equals pro.Value.ToString() join city in db.SysStatic on cu.CityID equals city.Value.ToString() where uc.ID.Equals(model.UserID) select new { #region MyRegion CityName = pro.Text, ProvinceName = city.Text, uc.ID, cu.Avatar, cu.FullName, cu.Name, cu.NameOfPIC, cu.Address, uc.RegisterTime, uc.LastLoginTime, uc.Phone #endregion }).FirstOrDefault(); //创建交易请求 TradingRequest tr = new TradingRequest(); tr.BZ = null; tr.CPRBH = client.ID; //持票企业编号 tr.CPRDH = client.Phone; //持票企业电话 tr.CPRMC = null; tr.EndTime = null; tr.FQR = client.ID; //发起人默认为持票企业 tr.FQSJ = DateTime.Now; //交易发起时间 tr.JYSHR = null; tr.JYSHSJ = null; tr.JYSHZT = "1"; tr.JYZT = ((int)TradeState.交易完成).ToString(); tr.SPRBH = (int)model.BidId; //贴现机构编号 tr.SPRDH = ""; //贴现机构电话 tr.SPRMC = null; tr.YWBH = followID; //创建票面信息 ParValueInfo pv = new ParValueInfo(); pv.CDHQC = model.BankName; Double cjjg = (Convert.ToDouble((model.BidPrice.ToString().Substring(0, model.BidPrice.ToString().LastIndexOf(".") + 3)))); pv.CJJG = (decimal)cjjg; pv.CJMSWJG = biding.BidPrice; pv.CJYLL = biding.BidRate; pv.DQR = (DateTime)model.TicketEndTime; //pv.JYQQBH = followID; pv.PMJE = model.TicketPrice; int imagesCount = 0; List <TicketImage> imageOrigin = db.TicketImage.Where(p => p.TicketID == model.TicketID).ToList(); if (imagesCount > 0) { pv.PMJT = imageOrigin[0].OriginImg; } else { pv.PMJT = model.TicketFaceImg; } pv.Pvid = model.TicketID; //交易记录 TCPJW_BATradingSystemCore.Trading.Trading.AddTradingDetail(tr, pv, client.ID, (int)model.BidId); CapitalDealInfo.UpdateJYCGCS((int)model.BidId); CapitalDealInfo.UpdatePJJYHS((int)model.BidId, (DateTime)model.ZfdjTime, (DateTime)model.WcjyTime); #endregion db.SaveChanges(); #endregion } else if (auditState == AuditState.审核不通过.ToString()) { #region 通过 model.TradeState = (int)TradeState.竞价中; db.SaveChanges(); #endregion } else { } return(Json(new { Tips = "操作成功", Status = 1 })); } catch (Exception ex) { return(Json(new { Tips = "操作失败", Status = 0 })); } return(null); }
public HttpResponseMessage PostBuy([FromBody] TradingRequest tr) => ProcessRequest(tr, TradingType.Buy);
public HttpResponseMessage PostSell([FromBody] TradingRequest tr) => ProcessRequest(tr, TradingType.Sell);