//**************************************** public void orderclose(Order o, orderStatus s) { GuestRequest grhelp = dal.GetGuestRequestList().Find(item => item.GuestRequestKey == o.GuestRequestKey); HostingUnit hhelp = getHostingUnitByKey(o.HostingUnitKey); int x = daysBetween(grhelp.EntryDate, grhelp.ReleaseDate); if (ApproveRequest(grhelp.EntryDate, x, hhelp) == true) { updateGuestRequestStatus(grhelp, grStatus.closedBySite); dal.updateOrderStatus(o, s); GuestRequest gr = getGuestRequestByKey(o.GuestRequestKey); diarymaker(o); var v = from item in dal.GetGuestRequestList() where item.ID == gr.ID/////################# select item; // where (grhelp.FamilyName == item.FamilyName) && (grhelp.PrivateName == item.PrivateName) //where item.GuestRequestKey == o.GuestRequestKey/////################# foreach (var item in v) { item.Status = grStatus.closedBySite; } //fee int numberDay = daysBetween(gr.EntryDate, gr.ReleaseDate); hhelp.feeAll = hhelp.feeAll + Configuration.fee * numberDay; } else { throw new Exception("bl:orderclose: cant order a hosting unit while its not available"); } }
public IActionResult Create(orderStatus orderStatus, string returnUrl = null) { if (ModelState.IsValid) { repository.AddEntity(orderStatus); return(RedirectToLocal(returnUrl)); } ViewData["ReturnUrl"] = returnUrl; return(View(orderStatus)); }
public void updateOrderStatus(Order o, orderStatus so) { XElement myorder = orderRoot.Elements().FirstOrDefault(item => int.Parse(item.Element("OrderKey").Value) == o.OrderKey); if (myorder == null) { throw new Exception("dalXml:updateOrderStatus : cant update order since it is not exists"); } myorder.Element("OrderDate").Value = o.OrderDate.ToString(); myorder.Element("Status").Value = so.ToString(); orderRoot.Save(orderPath); }
public IActionResult Edit(int id, orderStatus orderStatus, string returnUrl = null) { if (id != orderStatus.id) { return(NotFound()); } if (ModelState.IsValid) { this.repository.UpdateEntity(orderStatus); return(RedirectToLocal(returnUrl)); } ViewData["ReturnUrl"] = returnUrl; return(View(orderStatus)); }
//**************************************** public void updateOrderStatus(Order o, orderStatus s) { HostingUnit hhelp = getHostingUnitByKey(o.HostingUnitKey); GuestRequest gr = getGuestRequestByKey(o.GuestRequestKey); if (o.Status == orderStatus.closedResponse || o.Status == orderStatus.closedNoResponse) { throw new Exception("BL:updateOrderStatus: The order has been closed"); } //if (daysBetween(o.CreateDate) >= Configuration.ExpireRequest) //{ // dal.updateOrderStatus(o, orderStatus.closedNoResponse); //} thread :) if (s == orderStatus.emailSent) { o.OrderDate = DateTime.Now.Date; // sendAnEmail( o); //the mail will be sent when we will create the wpf if (dal.GetHostingUnitsList().Find(item => o.HostingUnitKey == item.HostingUnitKey).Owner.CollectionClearance == false) { throw new Exception("ERROR:updateOrderStatus: the guest didnt sign for Direct debit authorization"); } else { o.Status = s; o.OrderDate = DateTime.Now.Date; dal.updateOrderStatus(o, s); dal.GetOrderList().Find(item1 => o.HostingUnitKey == item1.HostingUnitKey).OrderDate = DateTime.Now; Console.WriteLine("mail sent"); } } if (s == orderStatus.closedResponse)//closedNoResponse { orderclose(o, s); } if (s == orderStatus.closedNoResponse)// { dal.updateOrderStatus(o, orderStatus.closedNoResponse); } }
//*********************************************** public void updateOrderStatus(Order o, orderStatus so) { if (DataSource.orderlist.Exists(item => item.OrderKey == o.OrderKey)) { DataSource.orderlist.Find(item => item.OrderKey == o.OrderKey).Status = so; if (so == orderStatus.emailSent) { DataSource.orderlist.Find(item => item.OrderKey == o.OrderKey).OrderDate = o.OrderDate; } //DataSource.orderlist.Remove(DataSource.orderlist.Find(item => item.OrderKey == o.OrderKey)); //DataSource.orderlist.Add(o.clone()); } else { o.Status = so; addOrder(o.clone()); throw new Exception("ERROR: the order was not exists"); } }
protected void Page_Load(object sender, System.EventArgs e) { if (!this.IsPostBack) { SortedDictionary <string, string> dic = new SortedDictionary <string, string>(); int type = -1; #region 参数验证 if (Request.QueryString["cid"] != null) { int.TryParse(Request.QueryString["cid"].ToString(), out cid); } if (cid <= 0) { Response.Write("paramter is not the numeric!"); return; } dic.Add("cid", this.cid.ToString()); if (Request.QueryString["orderStartTime"] != null) { long.TryParse(Request.QueryString["orderStartTime"].ToString(), out this.orderStartTime); } if (Request.QueryString["updateStartTime "] != null) { long.TryParse(Request.QueryString["updateStartTime "].ToString(), out this.UpdateStartTime); } #endregion #region 根据新增时间查询 if (this.orderStartTime > 0 && this.UpdateStartTime == 0)//根据新增时间查询 { if (Request.QueryString["orderEndTime"] == null) { Response.Write("参数数错误!"); return; } long.TryParse(Request.QueryString["orderEndTime"].ToString(), out orderEndTime); if (this.orderEndTime <= 0) { Response.Write("paramter is not the numeric!"); return; } start = StampToDateTime(this.orderStartTime.ToString()); end = StampToDateTime(this.orderEndTime.ToString()); dic.Add("orderStartTime", this.orderStartTime.ToString()); dic.Add("orderEndTime", this.orderEndTime.ToString()); type = 0; } #endregion #region 根据修改时间查询 if (this.orderStartTime == 0 && this.UpdateStartTime > 0) //根据修改时间查询 { if (Request.QueryString["updateEndTime"] == null) { Response.Write("paramter is not the numeric!"); return; } long.TryParse(Request.QueryString["updateEndTime"].ToString(), out this.EndUpdateTime); if (this.EndUpdateTime <= 0) { Response.Write("paramter is not the numeric!"); return; } start = StampToDateTime(this.UpdateStartTime.ToString()); end = StampToDateTime(this.EndUpdateTime.ToString()); type = 1; dic.Add("updateStartTime", this.UpdateStartTime.ToString()); dic.Add("updateEndTime", this.EndUpdateTime.ToString()); } #endregion #region 秘钥验证 if (Request.QueryString["mid"] == null) { Response.Write("paramter is not the numeric!"); return; } string kegSign = Request.QueryString["mid"].ToString(); string Sing = GetSing(dic); if (!kegSign.ToLower().Equals(Sing.ToLower())) { Response.Write("sign is error!"); return; } #endregion #region 是否进入参数 if (type < 0) { Response.Write("paramter is not the numeric!"); return; } #endregion #region 返回数据 try { DataTable dt = OrderHelper.SelectAdOrderInfo(cid, start, end, 0); #region 查询订单信息 if (type == 0) { List <orders> Nlist = new List <orders>(); AdOrderInfo ors = null; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { string Jsonstr = row["JsonStr"].ToString(); ors = Newtonsoft.Json.JsonConvert.DeserializeObject <AdOrderInfo>(Jsonstr); Nlist.Add(ors.orders[0]); } } if (Nlist.Count > 0) { Response.Write("{\"orders\":" + Newtonsoft.Json.JsonConvert.SerializeObject(Nlist) + "}"); return; } else { Response.Write("no data!"); } } #endregion #region 查询订单修改信息 if (type == 1) { AdOrerStatus adstatus = new AdOrerStatus(); List <orderStatus> stlist = new List <orderStatus>(); if (dt != null && dt.Rows.Count > 0) { orderStatus ords = null; foreach (DataRow row in dt.Rows) { ords = new orderStatus(); ords.orderstatus = row["OrderStatus"].ToString(); ords.paymentType = row["PaymentType"].ToString(); ords.paymentStatus = row["paymentStatus"].ToString(); ords.updateTime = row["UpdateDate"].ToString(); ords.feedback = row["feedback"].ToString(); ords.orderNo = row["OrderNo"].ToString(); stlist.Add(ords); } } adstatus.orderStatus = stlist; if (stlist.Count > 0) { Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(adstatus)); return; } else { Response.Write("no data!"); } } #endregion } catch (Exception ee) { Response.Write("request time out !" + ee.Message); } #endregion } }
public List<Order_info> getOrderInfos(orderStatus state) { int orderState = (int)state;; List<Order_info> list=new List<Order_info>(); try { using (DBC.HotelDBContent db = new DBC.HotelDBContent()) { string uId = new HotelInfoHelp().getUId(); int[] rf = (from h in db.hotel where h.u_id == uId select h.hotel_id).ToArray(); list = (from o in db.orders where rf.Contains(o.hotel_id) && o.o_state_id == orderState select o).ToList(); } // uId = "test1"; // var f = from h in db.drrs where rf.Contains(h.hotel_id) select h; } catch (Exception e) { throw e; } return list; }
protected override void DisplayMessage(string status) { switch (status) { case "ordernotfound": this.litMessage.Text = string.Format("没有找到对应的订单信息,订单号:{0}", this.OrderId); return; case "gatewaynotfound": this.litMessage.Text = "没有找到与此订单对应的支付方式,系统无法自动完成操作,请联系管理员"; return; case "verifyfaild": this.litMessage.Text = "支付返回验证失败,操作已停止"; return; case "success": #region 推送广告信息 try { if (System.Web.HttpContext.Current.Request.Cookies["AdCookies_cid"] != null && System.Web.HttpContext.Current.Request.Cookies["AdCookies_wi"] != null) { int.TryParse(System.Web.HttpContext.Current.Request.Cookies["AdCookies_cid"].Value.ToString(), out cid); wid = System.Web.HttpContext.Current.Request.Cookies["AdCookies_wi"].Value.ToString(); Action ac = new Action(() => { List <orderStatus> orderst = new List <orderStatus>(); orderStatus adInfo = new orderStatus(); adInfo.orderNo = this.OrderId; adInfo.feedback = wid; adInfo.updateTime = DateTime.Now.ToString("yyyy-MM-dd HH:MM:ss"); adInfo.orderstatus = "active"; adInfo.paymentStatus = "2"; adInfo.paymentType = "支付宝支付"; orderst.Add(adInfo); string jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(orderst); string url = "http://o.yiqifa.com/servlet/handleCpsInterIn"; string interId = System.Configuration.ConfigurationManager.AppSettings["interIdType"].ToString(); string DataStr = "interId=" + interId + "&json=" + HttpUtility.UrlEncode(jsonStr) + "&encoding=UTF-8"; string RqRest = HttpGet(url, DataStr); ErrorLog.Write("推送CPS返回结果:" + RqRest.ToString()); }); ac.BeginInvoke(null, ac); } else { ErrorLog.Write("没有获取Cookies值!"); } } catch (Exception ee) { } #endregion this.litMessage.Text = string.Format("恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}", this.OrderId, this.Amount.ToString("F")); return; case "exceedordermax": this.litMessage.Text = "订单为团购订单,订购数量超过订购总数,支付失败"; return; case "groupbuyalreadyfinished": this.litMessage.Text = "订单为团购订单,团购活动已结束,支付失败"; return; case "fail": this.litMessage.Text = string.Format("订单支付已成功,但是系统在处理过程中遇到问题,请联系管理员</br>支付金额:{0}", this.Amount.ToString("F")); return; } this.litMessage.Text = "未知错误,操作已停止"; }