private void RptBind(string _strWhere, string _orderby) { Model.wx_userweixin weixin = GetWeiXinCode(); //判断是否已经设置了微留言基本信息 BLL.wx_diancai_dingdan_manage sbll = new BLL.wx_diancai_dingdan_manage(); _strWhere = "wid=" + weixin.id + " " + _strWhere; this.page = MXRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; DataSet ds = gbll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); // DataSet ds = gbll.GetList( _strWhere); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr; int count = ds.Tables[0].Rows.Count; for (int i = 0; i < count; i++) { dr = ds.Tables[0].Rows[i]; } ds.AcceptChanges(); } this.rptList.DataSource = ds; this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("caidan_list_all.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private DataSet QueryData(bool isDownLoad = false) { //判断是否已经设置了微留言基本信息 this.page = MXRequest.GetQueryInt("page", 1); var result = gbll.GetOrderList(shopid, isDownLoad ? this.totalCount : this.pageSize, isDownLoad ? 1 : this.page, beginDate, endDate, payAmountMin, payAmountMax, orderNumber, customerName, customerTel, out this.totalCount); this.total.Value = totalCount.ToString(); var sbll = new BLL.wx_diancai_dingdan_manage(); if (result != null && result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0) { DataRow dr; int count = result.Tables[0].Rows.Count; for (int i = 0; i < count; i++) { dr = result.Tables[0].Rows[i]; var orderId = Convert.ToInt32(dr["id"]); var detail = sbll.GetOrderCaipinDetail(orderId); dr["Detail"] = detail; dr["OrderNo"] = i + 1; } result.AcceptChanges(); } return(result); }
protected void save_groupbase_Click(object sender, EventArgs e) { var status = StatusManager.DishStatus.Used.StatusID; Guid identifyingCodeId; if (Guid.TryParse(cid, out identifyingCodeId)) { var identifyingCodeObject = IdentifyingCodeService.GetIdentifyingCodeInfoByIdentifyingCodeId(identifyingCodeId, ModuleName, wid); if (identifyingCodeObject != null && identifyingCodeObject.ShopId.Equals(shopid.ToString())) { var order = new BLL.wx_diancai_dingdan_manage().GetModel(int.Parse(identifyingCodeObject.OrderId)); if (order != null && order.payStatus != null) { if (order.payStatus.Value.Equals(StatusManager.DishStatus.PreRefund.StatusID) || order.payStatus.Value.Equals(StatusManager.DishStatus.Refund.StatusID) || order.payStatus.Value.Equals(StatusManager.DishStatus.Used.StatusID) || order.IsFinish) { this.Response.Write( "<script language='javascript' type='text/javascript'>alert('该订单已完成或进行退单处理,不能进行验证!')</script>"); } else { identifyingCodeObject.Status = StatusManager.DishStatus.Used.StatusID; identifyingCodeObject.ModifyTime = DateTime.Now; using (var scope = new TransactionScope()) { IdentifyingCodeService.ModifyIdentifyingCodeInfo(identifyingCodeObject); managebll.AfterVerification(wid, shopid, int.Parse(identifyingCodeObject.OrderId)); scope.Complete(); } manage = managebll.GetModel(MyCommFun.Str2Int(id)); BLL.wx_diancai_member menbll = new BLL.wx_diancai_member(); if (status == StatusManager.DishStatus.Used.StatusID) { menbll.Update(manage.openid); } if (status == StatusManager.DishStatus.PreRefund.StatusID || status == StatusManager.DishStatus.Refund.StatusID) { menbll.Updatefail(manage.openid); } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改支付状态,主键为" + id); //记录日志 //JscriptMsg("修改成功!", "dingdan_confirm.aspx?shopid=" + shopid + "", "Success"); //Response.Redirect("dingdan_confirm.aspx?shopid=" + shopid + ""); Response.Write("<script language='javascript' type='text/javascript'>alert('核销成功!');location.href = 'dingdan_confirm.aspx?shopid=" + shopid + "';</script>"); } } } } }
public void GetDetail(int orderId) { var result = new BLL.wx_diancai_dingdan_manage().GetOrderDetail(orderId); if (result != null && result.Tables.Count > 0) { var orderTable = result.Tables[0]; var orderCaipinTable = result.Tables[1]; if (orderTable.Rows.Count > 0) { var orderTableFirstRow = orderTable.Rows[0]; this.OrderID = orderTableFirstRow.Field <int>("OrderID"); this.customerName = orderTableFirstRow.Field <string>("customerName"); this.customerTel = orderTableFirstRow.Field <string>("customerTel"); this.dcRename = orderTableFirstRow.Field <string>("dcRename"); this.hotelName = orderTableFirstRow.Field <string>("hotelName"); this.hoteltimeBegin = orderTableFirstRow.Field <DateTime?>("hoteltimeBegin"); this.hoteltimeBegin1 = orderTableFirstRow.Field <DateTime?>("hoteltimeBegin1"); this.hoteltimeBegin2 = orderTableFirstRow.Field <DateTime?>("hoteltimeBegin2"); this.hoteltimeEnd = orderTableFirstRow.Field <DateTime?>("hoteltimeEnd"); this.hoteltimeEnd1 = orderTableFirstRow.Field <DateTime?>("hoteltimeEnd1"); this.hoteltimeEnd2 = orderTableFirstRow.Field <DateTime?>("hoteltimeEnd2"); this.oderTime = orderTableFirstRow.Field <DateTime>("oderTime"); this.orderNumber = orderTableFirstRow.Field <string>("orderNumber"); this.payAmount = orderTableFirstRow.Field <double>("payAmount"); this.tel = orderTableFirstRow.Field <string>("tel"); this.xplace = orderTableFirstRow.Field <double>("xplace"); this.yplace = orderTableFirstRow.Field <double>("yplace"); } if (orderCaipinTable.Rows.Count > 0) { foreach (DataRow row in orderCaipinTable.Rows) { var newOrderCaipinDetail = new OrderCaipinDetail(); newOrderCaipinDetail.caiId = Convert.ToInt32(row.Field <string>("ProductID")); newOrderCaipinDetail.identifyingcode = row.Field <string>("identifyingcode"); newOrderCaipinDetail.cpName = row.Field <string>("cpName"); newOrderCaipinDetail.price = Convert.ToDecimal(row.Field <double>("price")); newOrderCaipinDetail.status = row.Field <int>("status"); if (this.OrderCaipinDetail.ContainsKey(newOrderCaipinDetail.caiId)) { this.OrderCaipinDetail[newOrderCaipinDetail.caiId].Add(newOrderCaipinDetail); } else { this.OrderCaipinDetail.Add(newOrderCaipinDetail.caiId, new List <OrderCaipinDetail>() { newOrderCaipinDetail }); } } } } }
protected void Page_Load(object sender, EventArgs e) { try { shopid = MyCommFun.RequestInt("shopid"); dingdan = MyCommFun.RequestInt("dingdan"); openid = MyCommFun.QueryString("openid"); caiid = MyCommFun.RequestInt("caiid"); wid = MyCommFun.RequestInt("wid"); if (!IsPostBack) { var result = new BLL.wx_diancai_dingdan_manage().GetDingdanRefundDetail(shopid, dingdan, openid, caiid); if (result != null && result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0) { RestruantName = result.Tables[0].Rows[0].Field <string>("hotelName"); OrderNumber = result.Tables[0].Rows[0].Field <string>("orderNumber"); CaiPinName = result.Tables[0].Rows[0].Field <string>("cpName"); Price = result.Tables[0].Rows[0].Field <double>("price"); NoUseCount = result.Tables[0].Rows.Count; this.txtRefundAmount.Text = string.Format("{0}元", Price); //缓存订单菜id var caiidListString = string.Empty; foreach (DataRow row in result.Tables[0].Rows) { if (result.Tables[0].Rows.IndexOf(row) == result.Tables[0].Rows.Count - 1) { caiidListString = caiidListString + row.Field <Guid>("IdentifyingCodeId"); } else { caiidListString = caiidListString + row.Field <Guid>("IdentifyingCodeId") + ","; } } this.caiidList.Value = caiidListString; } else { OrderNumber = "该订单号不存在或该订单中不存在未消费的菜品"; this.btnRefund.Visible = false; } } } catch (Exception exception) { Response.Write(exception.Message); } }
private void RptBind(string _strWhere, string _orderby) { // Model.wx_userweixin weixin = GetWeiXinCode(); //判断是否已经设置了微留言基本信息 BLL.wx_diancai_dingdan_manage sbll = new BLL.wx_diancai_dingdan_manage(); _strWhere = "shopinfoid=" + shopid + " " + _strWhere; this.page = MXRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; DataSet ds = gbll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); // DataSet ds = gbll.GetList( _strWhere); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr; int count = ds.Tables[0].Rows.Count; for (int i = 0; i < count; i++) { dr = ds.Tables[0].Rows[i]; if (dr["payStatus"].ToString() == "0") { dr["payStatusStr"] = "未处理"; } else if (dr["payStatus"].ToString() == "1") { dr["payStatusStr"] = "成功"; } else { dr["payStatusStr"] = "失败"; } } ds.AcceptChanges(); } this.rptList.DataSource = ds; this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("dingdan_manage.aspx", "keywords={0}&page={1}&shopid={2}", this.keywords, "__id__", shopid.ToString()); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
protected void confirm_dingdan_Click(object sender, EventArgs e) { var number = this.confirmnumber.Text.Trim(); var identifyingCode = IdentifyingCodeService.GetConfirmIdentifyingCodeInfo(shopid, number, ModuleName, wid); if (identifyingCode == null) { Response.Write("<script language='javascript' type='text/javascript'>alert('该订单不存在或未付款,请确认!')</script>"); } else if (identifyingCode.Status != StatusManager.DishStatus.NoUsed.StatusID && identifyingCode.Status != StatusManager.DishStatus.RefundFaild.StatusID) { Response.Write("<script language='javascript' type='text/javascript'>alert('该商品已消费或者退单,请确认!')</script>"); } else { var order = new BLL.wx_diancai_dingdan_manage().GetModel(int.Parse(identifyingCode.OrderId)); if (order != null && order.payStatus != null) { if (order.payStatus.Value.Equals(StatusManager.DishStatus.PreRefund.StatusID) || order.payStatus.Value.Equals(StatusManager.DishStatus.Refund.StatusID) || order.payStatus.Value.Equals(StatusManager.DishStatus.Used.StatusID) || order.IsFinish) { this.Response.Write( "<script language='javascript' type='text/javascript'>alert('该订单已完成或进行退单处理,不能进行验证!')</script>"); } else { Response.Redirect("commodity_detail.aspx?cid=" + identifyingCode.IdentifyingCodeId + "&shopid=" + identifyingCode.ShopId + "&id=" + identifyingCode.OrderId); } } } }
public void ProcessRequest(HttpContext context) { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); string username = MyCommFun.QueryString("username"); string parssword = MyCommFun.QueryString("parssword"); string id = MyCommFun.QueryString("id"); string openid = MyCommFun.QueryString("openid"); string state = MyCommFun.QueryString("state"); string goodsData = QueryString("goodsData"); int shopid = MyCommFun.RequestInt("shopid"); BLL.wx_diancai_dianyuan dianyuanbll = new BLL.wx_diancai_dianyuan(); Model.wx_diancai_dianyuan dianyuan = new Model.wx_diancai_dianyuan(); BLL.wx_diancai_caipin_category categorybll = new BLL.wx_diancai_caipin_category(); BLL.wx_diancai_member menberbll = new BLL.wx_diancai_member(); Model.wx_diancai_member member = new Model.wx_diancai_member(); BLL.wx_diancai_dingdan_manage manage = new BLL.wx_diancai_dingdan_manage(); Model.wx_diancai_dingdan_manage managemodel = new Model.wx_diancai_dingdan_manage(); BLL.wx_diancai_dingdan_caiping caipinbll = new BLL.wx_diancai_dingdan_caiping(); Model.wx_diancai_dingdan_caiping caipin = new Model.wx_diancai_dingdan_caiping(); if (_action == "login") { if (dianyuanbll.Exists(username, parssword)) { jsonDict.Add("ret", "ok"); jsonDict.Add("content", "登录成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "密码错误!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (_action == "setstatus") { //id if (manage.Updatestatus(id, state)) { managemodel = manage.GetModel(MyCommFun.Str2Int(id)); BLL.wx_diancai_member menbll = new BLL.wx_diancai_member(); if (state == "1") { menbll.Update(managemodel.openid); } if (state == "2") { menbll.Updatefail(managemodel.openid); } jsonDict.Add("ret", "ok"); jsonDict.Add("content", "提交成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (_action == "addmember") { #region 用户基本信息管理 member = menberbll.GetModel(shopid, openid); bool isAdd = false; if (member == null) { isAdd = true; } else { if (member.status.Value == 0) { //处于黑名单里 jsonDict.Add("ret", "fail"); jsonDict.Add("content", "您处于黑名单里!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } } member.shopid = shopid; member.openid = openid; member.weixinName = MyCommFun.QueryString("weixinName"); member.Name = MyCommFun.QueryString("username"); member.memberName = MyCommFun.QueryString("username"); member.menberTel = MyCommFun.QueryString("customerTel"); member.memberAddress = MyCommFun.QueryString("address"); member.successDingdan = 0; member.failDingdan = 0; member.cancelDingdan = 0; member.zongjifen = 0; member.zongcje = 0; member.status = 0; member.createDate = DateTime.Now; if (isAdd) { menberbll.Add(member); } else { menberbll.Update(member); } jsonDict.Add("ret", "ok"); jsonDict.Add("content", "提交成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); #endregion } else if (_action == "addcaidan") { string deskNumber = MyCommFun.QueryString("deskNumber");//桌号 //用户点菜完,提交订单 #region 判断参数是否合法,判断用户是否处于黑名单里 if (goodsData == "" || openid == "") { jsonDict.Add("ret", "err"); jsonDict.Add("content", "订单提交失败,参数为空值!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } member = menberbll.GetModel(shopid, openid); bool isAdd = false; if (member == null) { isAdd = true; member = new Model.wx_diancai_member(); } else { if (member.status.Value == 0) { //处于黑名单里 jsonDict.Add("ret", "fail"); jsonDict.Add("content", "您处于黑名单里,不能下单!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } } #endregion //获得商家信息 BLL.wx_diancai_shopinfo shopbll = new BLL.wx_diancai_shopinfo(); Model.wx_diancai_shopinfo shopinfoEntity = new Model.wx_diancai_shopinfo(); shopinfoEntity = shopbll.GetModel(shopid); #region 计算商品总价格 decimal payAmount = 0; string[] sArray = goodsData.Split(';'); for (int i = 0; i < sArray.Length - 1; i++) { string[] sAr = sArray[i].Split(','); payAmount += Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]);//总价 } #endregion member.shopid = shopid; member.openid = openid; member.Name = MyCommFun.QueryString("name"); member.memberName = MyCommFun.QueryString("name"); member.menberTel = MyCommFun.QueryString("phone"); member.memberAddress = MyCommFun.QueryString("address"); member.successDingdan = 0; member.failDingdan = 0; member.cancelDingdan = 0; member.zongjifen = 0; member.zongcje = 0; member.status = 0; member.createDate = DateTime.Now; if (isAdd) { menberbll.Add(member); } else { menberbll.Update(member); } #region //订单信息 managemodel.shopinfoid = shopid; managemodel.openid = openid; managemodel.orderNumber = Utils.Number(13); //订单号 managemodel.deskNumber = deskNumber; //桌号deskNumber managemodel.customerName = MyCommFun.QueryString("name"); managemodel.customerTel = MyCommFun.QueryString("phone"); managemodel.address = MyCommFun.QueryString("address"); managemodel.oderRemark = MyCommFun.QueryString("oderRemark"); managemodel.payStatus = 0; managemodel.oderRemark = ""; managemodel.oderTime = DateTime.Now; managemodel.createDate = DateTime.Now; int idf = manage.Add(managemodel); #endregion #region //form表单提交 BLL.wx_diancai_form_control cBll = new BLL.wx_diancai_form_control(); IList <Model.wx_diancai_form_control> controlList = cBll.GetModelList("shopinfoId=" + shopid); if (controlList != null) { BLL.wx_diancai_form_result retBll = new BLL.wx_diancai_form_result(); Model.wx_diancai_form_result result = new Model.wx_diancai_form_result(); result.shopinfoId = shopid; result.openid = openid; result.createDate = DateTime.Now; Model.wx_diancai_form_control control = new Model.wx_diancai_form_control(); for (int i = 0; i < controlList.Count; i++) { control = controlList[i]; string reqControlIdValue = MyCommFun.QueryString("control_" + control.seq); result.cId = control.seq; result.cName = control.cName; result.userResult = reqControlIdValue; retBll.Add(result); } } #endregion //菜品 for (int i = 0; i < sArray.Length - 1; i++) { string[] sAr = sArray[i].Split(','); caipin.dingId = idf; caipin.caiId = Convert.ToInt32(sAr[0]); //菜品ID caipin.num = Convert.ToInt32(sAr[1]); //菜品件数 caipin.price = Convert.ToDecimal(sAr[2]); //菜品单价 caipin.totpric = Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]); //总价 // payAmount += Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]);//客户购买总价 caipinbll.Add(caipin); } //订单满多少免配送费 if (payAmount < shopinfoEntity.freeSendcost) { payAmount += Convert.ToDecimal(shopinfoEntity.sendCost); } bool isOk = manage.Update(idf, payAmount); if (isOk) { jsonDict.Add("ret", "ok"); jsonDict.Add("content", "订单提交成功!请到订单查看!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("ret", "err"); jsonDict.Add("content", "订单提交失败!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } context.Response.End(); } }
public void ProcessRequest(HttpContext context) { Dictionary<string, string> jsonDict = new Dictionary<string, string>(); context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); string username = MyCommFun.QueryString("username"); string parssword = MyCommFun.QueryString("parssword"); string id = MyCommFun.QueryString("id"); string openid = MyCommFun.QueryString("openid"); string state = MyCommFun.QueryString("state"); string goodsData = QueryString("goodsData"); int shopid = MyCommFun.RequestInt("shopid"); BLL.wx_diancai_dianyuan dianyuanbll = new BLL.wx_diancai_dianyuan(); Model.wx_diancai_dianyuan dianyuan = new Model.wx_diancai_dianyuan(); BLL.wx_diancai_caipin_category categorybll = new BLL.wx_diancai_caipin_category(); BLL.wx_diancai_member menberbll = new BLL.wx_diancai_member(); Model.wx_diancai_member member = new Model.wx_diancai_member(); BLL.wx_diancai_dingdan_manage manage = new BLL.wx_diancai_dingdan_manage(); Model.wx_diancai_dingdan_manage managemodel = new Model.wx_diancai_dingdan_manage(); BLL.wx_diancai_dingdan_caiping caipinbll = new BLL.wx_diancai_dingdan_caiping(); Model.wx_diancai_dingdan_caiping caipin = new Model.wx_diancai_dingdan_caiping(); if (_action == "login") { if (dianyuanbll.Exists(username, parssword)) { jsonDict.Add("ret", "ok"); jsonDict.Add("content", "登录成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "密码错误!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (_action == "setstatus") { //id if (manage.Updatestatus(id, state)) { jsonDict.Add("ret", "ok"); jsonDict.Add("content", "提交成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (_action =="addmember") { member.shopid = shopid; openid = Utils.Number(18); member.openid = openid; member.weixinName = MyCommFun.QueryString("weixinName"); member.memberName = MyCommFun.QueryString("username"); member.menberTel = MyCommFun.QueryString("customerTel"); member.memberAddress = MyCommFun.QueryString("address"); member.successDingdan = 0; member.failDingdan = 0; member.cancelDingdan = 0; member.zongjifen = 0; member.zongcje = 0; member.status = 1; member.createDate = DateTime.Now; menberbll.Add(member); jsonDict.Add("ret", "ok"); jsonDict.Add("content", "提交成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } else if (_action == "addcaidan") { if (goodsData == "") { jsonDict.Add("ret", "err"); jsonDict.Add("content", "goodsData为空值!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (openid == "") { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "订单提交失败!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } //用户信息 managemodel.shopinfoid = shopid; managemodel.openid = openid; managemodel.orderNumber = Utils.Number(13);//订单号 managemodel.deskNumber = "";//桌号 // manage.customerName = this.name.Value; //manage.customerTel = this.phone.Value; managemodel.payStatus = 0; managemodel.oderRemark = ""; managemodel.oderTime = DateTime.Now; managemodel.createDate = DateTime.Now; int idf = manage.Add(managemodel); decimal payAmount = 0; //菜品 string[] sArray = goodsData.Split(';'); for (int i = 0; i < sArray.Length - 1; i++) { string[] sAr = sArray[i].Split(','); caipin.dingId = idf; caipin.caiId = Convert.ToInt32(sAr[0]);//菜品ID caipin.num = Convert.ToInt32(sAr[1]);//菜品件数 caipin.price = Convert.ToDecimal(sAr[2]);//菜品单价 caipin.totpric = Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]);//总价 payAmount += Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]);//客户购买总价 caipinbll.Add(caipin); } bool isOk= manage.Update(idf, payAmount); if (isOk) { jsonDict.Add("ret", "ok"); jsonDict.Add("content", "订单提交成功!请到订单查看!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("ret", "err"); jsonDict.Add("content", "订单提交失败!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } context.Response.End(); } }
public void ProcessRequest(HttpContext context) { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); string username = MyCommFun.QueryString("username"); string parssword = MyCommFun.QueryString("parssword"); string id = MyCommFun.QueryString("id"); string openid = MyCommFun.QueryString("openid"); string state = MyCommFun.QueryString("state"); string goodsData = QueryString("goodsData"); int shopid = MyCommFun.RequestInt("shopid"); BLL.wx_diancai_dianyuan dianyuanbll = new BLL.wx_diancai_dianyuan(); Model.wx_diancai_dianyuan dianyuan = new Model.wx_diancai_dianyuan(); BLL.wx_diancai_caipin_category categorybll = new BLL.wx_diancai_caipin_category(); BLL.wx_diancai_member menberbll = new BLL.wx_diancai_member(); Model.wx_diancai_member member = new Model.wx_diancai_member(); BLL.wx_diancai_dingdan_manage manage = new BLL.wx_diancai_dingdan_manage(); Model.wx_diancai_dingdan_manage managemodel = new Model.wx_diancai_dingdan_manage(); BLL.wx_diancai_dingdan_caiping caipinbll = new BLL.wx_diancai_dingdan_caiping(); Model.wx_diancai_dingdan_caiping caipin = new Model.wx_diancai_dingdan_caiping(); if (_action == "login") { if (dianyuanbll.Exists(username, parssword)) { jsonDict.Add("ret", "ok"); jsonDict.Add("content", "登录成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "密码错误!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (_action == "setstatus") { //id if (manage.Updatestatus(id, state)) { jsonDict.Add("ret", "ok"); jsonDict.Add("content", "提交成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (_action == "addmember") { member.shopid = shopid; openid = Utils.Number(18); member.openid = openid; member.weixinName = MyCommFun.QueryString("weixinName"); member.memberName = MyCommFun.QueryString("username"); member.menberTel = MyCommFun.QueryString("customerTel"); member.memberAddress = MyCommFun.QueryString("address"); member.successDingdan = 0; member.failDingdan = 0; member.cancelDingdan = 0; member.zongjifen = 0; member.zongcje = 0; member.status = 1; member.createDate = DateTime.Now; menberbll.Add(member); jsonDict.Add("ret", "ok"); jsonDict.Add("content", "提交成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } else if (_action == "addcaidan") { if (goodsData == "") { jsonDict.Add("ret", "err"); jsonDict.Add("content", "goodsData为空值!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (openid == "") { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "订单提交失败!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } //用户信息 managemodel.shopinfoid = shopid; managemodel.openid = openid; managemodel.orderNumber = Utils.Number(13); //订单号 managemodel.deskNumber = ""; //桌号 // manage.customerName = this.name.Value; //manage.customerTel = this.phone.Value; managemodel.payStatus = 0; managemodel.oderRemark = ""; managemodel.oderTime = DateTime.Now; managemodel.createDate = DateTime.Now; int idf = manage.Add(managemodel); decimal payAmount = 0; //菜品 string[] sArray = goodsData.Split(';'); for (int i = 0; i < sArray.Length - 1; i++) { string[] sAr = sArray[i].Split(','); caipin.dingId = idf; caipin.caiId = Convert.ToInt32(sAr[0]); //菜品ID caipin.num = Convert.ToInt32(sAr[1]); //菜品件数 caipin.price = Convert.ToDecimal(sAr[2]); //菜品单价 caipin.totpric = Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]); //总价 payAmount += Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]); //客户购买总价 caipinbll.Add(caipin); } bool isOk = manage.Update(idf, payAmount); if (isOk) { jsonDict.Add("ret", "ok"); jsonDict.Add("content", "订单提交成功!请到订单查看!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("ret", "err"); jsonDict.Add("content", "订单提交失败!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } context.Response.End(); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); string username = MyCommFun.QueryString("username"); string parssword = MyCommFun.QueryString("parssword"); string id = MyCommFun.QueryString("id"); openid = MyCommFun.QueryString("openid"); string state = MyCommFun.QueryString("state"); goodsData = QueryString("goodsData"); shopid = MyCommFun.RequestInt("shopid"); BLL.wx_diancai_dianyuan dianyuanbll = new BLL.wx_diancai_dianyuan(); BLL.wx_diancai_dingdan_manage manage = new BLL.wx_diancai_dingdan_manage(); Model.wx_diancai_dingdan_manage managemodel = new Model.wx_diancai_dingdan_manage(); if (_action == "login") { if (dianyuanbll.Exists(username, parssword)) { jsonDict.Add("ret", "ok"); jsonDict.Add("content", "登录成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "密码错误!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (_action == "setstatus") { //id if (manage.Updatestatus(id, state)) { managemodel = manage.GetModel(MyCommFun.Str2Int(id)); BLL.wx_diancai_member menbll = new BLL.wx_diancai_member(); if (state == "1") { menbll.Update(managemodel.openid); } if (state == "2") { menbll.Updatefail(managemodel.openid); } jsonDict.Add("ret", "ok"); jsonDict.Add("content", "提交成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (_action == "addcaidan") { var orderProcessResult = this.ProcessOrder(); if (!orderProcessResult.IsSuccess) { this.jsonDict.Add("ret", "err"); this.jsonDict.Add("content", orderProcessResult.Message); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } var order = orderProcessResult.BusinessData as Model.wx_diancai_dingdan_manage; if (order != null) { //this.jsonDict.Add("ret", "ok"); //this.jsonDict.Add("content", orderProcessResult.Message); //this.jsonDict.Add("orderid", order.id.ToString()); //this.jsonDict.Add("ordercode", order.orderNumber); //this.jsonDict.Add("openid", openid); //this.jsonDict.Add("payamount", order.payAmount.ToString()); //this.jsonDict.Add("shopname", new BLL.wx_diancai_shopinfo().GetModel(this.shopid).hotelName); //this.jsonDict.Add("wid", order.wid.ToString()); //this.jsonDict.Add("orderNumber", order.orderNumber); //context.Response.Write(MyCommFun.getJsonStr(this.jsonDict)); var shopInfo = new BLL.wx_diancai_shopinfo().GetModel(this.shopid); var entity = new UnifiedOrderEntity { OrderId = order.id.ToString(), wid = order.wid, total_fee = order.payAmount == null ? 0 : (int)order.payAmount, out_trade_no = order.orderNumber, openid = openid, body = string.Format("订单编号{0} {1}", order.orderNumber, shopInfo.hotelName), PayModuleID = (int)PayModuleEnum.Restaurant, PayComplete = "../restaurant/AfterPay.aspx" }; entity.Extra.Add("content", orderProcessResult.Message); entity.Extra.Add("shopname", new BLL.wx_diancai_shopinfo().GetModel(this.shopid).hotelName); entity.Extra.Add("shopid", shopid.ToString()); entity.Extra.Add("wid", shopInfo.wid.ToString()); var ticket = EncryptionManager.CreateIV(); var payData = EncryptionManager.AESEncrypt(entity.ToJson(), ticket); context.Response.Write(AjaxResult.Success(PayHelper.GetPayUrl(payData, ticket))); } context.Response.End(); } else if (_action == "productDetail") { var productId = MyCommFun.QueryString("productId"); if (!string.IsNullOrEmpty(productId)) { var model = new BLL.wx_diancai_caipin_manage().GetModel(int.Parse(productId)); String useRange = string.Empty; if (model.beginDate.HasValue || model.endDate.HasValue) { useRange = string.Format("{0}至{1}", model.beginDate.HasValue ? model.beginDate.Value.ToString("yyyy-MM-dd") : string.Empty, model.endDate.HasValue ? model.endDate.Value.ToString("yyyy-MM-dd") : string.Empty); } var data = new { shopIntroduction = model.shopIntroduction, detailContent = model.detailContent, instructions = model.instructions, chargeback = model.chargeback, useRange = useRange }; context.Response.Write(AjaxResult.Success(data).ToCamelString()); } context.Response.End(); } else if (_action == "caipinDetail") { var caipinId = MyCommFun.RequestInt("caipinId"); var caipinModel = new BLL.wx_diancai_caipin_manage().GetModel(caipinId); String useRange = string.Empty; if (caipinModel.beginDate.HasValue || caipinModel.endDate.HasValue) { useRange = string.Format("{0}至{1}", caipinModel.beginDate.HasValue ? caipinModel.beginDate.Value.ToString("yyyy-MM-dd") : string.Empty, caipinModel.endDate.HasValue ? caipinModel.endDate.Value.ToString("yyyy-MM-dd") : string.Empty); } String jianjie = caipinModel.shopIntroduction; String tuidanRule = caipinModel.chargeback; string pictureUrl = caipinModel.picUrl; var result = new { Name = caipinModel.cpName, Url = MapUrl(pictureUrl), Range = useRange, Intruduce = jianjie, Rule = tuidanRule, suoming = caipinModel.detailContent, shopIntroduction = caipinModel.shopIntroduction }; context.Response.Write(AjaxResult.Success(result)); context.Response.End(); } }
public void GetPay(string openID) { var managebll = new BLL.wx_diancai_dingdan_manage(); DataSet dr = managebll.GetPayList(openID); if (dr.Tables[0].Rows.Count > 0) { var detailBuilder = new StringBuilder(); for (int i = 0; i < dr.Tables[0].Rows.Count; i++) { var payStatus = dr.Tables[0].Rows[i]["payStatus"].ToString(); string payStatusText; string payStatusCss = string.Empty; switch (payStatus) { case "1": payStatusText = "等待使用"; break; case "2": case "4": //部分退款 payStatusText = "未使用"; payStatusCss = "status-refundPart"; break; case "3": payStatusText = "已使用"; //payStatusCss = "status-refundAll"; break; case "5": //全部退款 payStatusText = "未使用"; payStatusCss = "status-refundAll"; break; default: payStatusText = "未处理"; break; } detailBuilder.Append("<ul>"); detailBuilder.Append("<li>"); detailBuilder.AppendFormat("<a href=\"diancai_orderDetail.aspx?wid={0}&shopid={1}&dingdan={2}&openid={3}\">", dr.Tables[0].Rows[i]["wid"].ToString(), dr.Tables[0].Rows[i]["shopinfoid"].ToString(), dr.Tables[0].Rows[i]["id"].ToString(), openId ); detailBuilder.Append("<div class=\"info_01\">"); if (!string.IsNullOrEmpty(payStatusCss)) { detailBuilder.AppendFormat("<i class=\"{0} i-status\"></i>", payStatusCss); } detailBuilder.AppendFormat("<h3>{0}</h3>", dr.Tables[0].Rows[i].Field <string>("hotelName")); detailBuilder.AppendFormat("<p>实付<b>¥{0}</b>共<b>{1}</b>件商品</p>", dr.Tables[0].Rows[i]["payAmount"].ToString(), dr.Tables[0].Rows[i]["OrderCount"].ToString()); detailBuilder.Append("<span class=\"wave_blue_icon\"></span>"); detailBuilder.Append("</div>"); detailBuilder.Append("<div class=\"info_02\">"); detailBuilder.Append("<dl>"); detailBuilder.AppendFormat("<dd><b class=\"i_gray_icon\"></b>订单编号 {0}</dd>", dr.Tables[0].Rows[i]["orderNumber"].ToString()); detailBuilder.AppendFormat("<dd><b class=\"time_gray_icon\"></b>购票日期 {0}</dd>", dr.Tables[0].Rows[i]["oderTime"].ToString()); //此处应该有购票日期 detailBuilder.Append("</dl>"); detailBuilder.Append("</div>"); detailBuilder.Append("<div class=\"info_03\">"); detailBuilder.AppendFormat("<span>{0}</span>", payStatusText); detailBuilder.Append("</div>"); detailBuilder.Append("</a>"); detailBuilder.Append("</li>"); detailBuilder.Append("</ul>"); } str = detailBuilder.ToString(); } }