/// <summary> /// 加载数据 /// </summary> /// <param name="strWhere">条件</param> void LoadData(string strWhere) { MSShoppingCartDAL orderDal = new MSShoppingCartDAL(); DataSet ds = orderDal.GetCustomerOrderList(strWhere); DataView dv = ds.Tables[0].DefaultView; AspNetPager1.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; Repeater1.DataSource = pds; Repeater1.DataBind(); }
void showdetailinfo() { MSShoppingCartDAL orderDal = new MSShoppingCartDAL(); string strWhere = string.Empty; strWhere = " and a.ID='" + strID + "' "; DataSet orderds = orderDal.GetCustomerOrderList(strWhere); string paytime = string.Empty; if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0) { ptitle.Text = orderds.Tables[0].Rows[0]["Ptitle"].ToString(); Quantity.Text = orderds.Tables[0].Rows[0]["Quantity"].ToString(); UnitCost.Text = orderds.Tables[0].Rows[0]["UnitCost"].ToString(); shopname.Text = orderds.Tables[0].Rows[0]["ShopName"].ToString(); paytime = orderds.Tables[0].Rows[0]["PayTime"].ToString(); buyname.Text = orderds.Tables[0].Rows[0]["buyname"].ToString(); zipcode.Text = orderds.Tables[0].Rows[0]["zipcode"].ToString(); phone.Text = orderds.Tables[0].Rows[0]["phone"].ToString(); ReveiveAddress.Text = orderds.Tables[0].Rows[0]["ReveiveAddress"].ToString(); string pay = orderds.Tables[0].Rows[0]["PayWay"].ToString(); string[] way = pay.Split('|'); try { pay = way[1].ToString(); } catch (Exception) { } payway.Text = pay; } if (paytime.ToString().Trim() != "1900-01-0100:00:00.000") { PayTime.Text = orderds.Tables[0].Rows[0]["PayTime"].ToString(); } if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { string strOpenID = string.Empty; string strIP = string.Empty; string strChargeType = string.Empty; string strCustNo = string.Empty; string strChargeAmount = string.Empty; string strCelWhere = string.Empty; string strDiscount = string.Empty; //ChargeFeeOK.aspx?type=$chargetype&openid=$OpenID&chargeno=$ChargeNo&chargeamount=$ChargeAmount if (null == Request.QueryString["type"]) { return; } if (null == Request.QueryString["openid"]) { return; } if (null == Request.QueryString["chargeno"]) { return; } if (null == Request.QueryString["chargeamount"]) { return; } if (null == Request.QueryString["celWhere"]) { return; } if (Request.QueryString["openid"].ToString().Length > 29 || Request.QueryString["openid"].ToString().Length < 25) { strOpenID = Common.Common.NoHtml(Request.QueryString["openid"].ToString()); } else { strOpenID = Request.QueryString["openid"].ToString(); } strIP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; strChargeType = Common.Common.NoHtml(Request.QueryString["type"].ToString()); strCustNo = Common.Common.NoHtml(Request.QueryString["chargeno"].ToString()); strChargeAmount = Common.Common.NoHtml(Request.QueryString["chargeamount"].ToString()); strCelWhere = Common.Common.NoHtml(Request.QueryString["celWhere"].ToString()); //插入订单数据 //调用支付接口返回成功写数据到缴费平台 //DAL.MiniShop.MSChargeFeeOrder dal = new DAL.MiniShop.MSChargeFeeOrder(); //Model.MiniShop.MSChargeFeeOrder model = new Model.MiniShop.MSChargeFeeOrder(); //model.ID = Guid.NewGuid().ToString("N").ToUpper(); //model.OpenID = strOpenID; //model.CustNo = strCustNo; //model.ChargeAmount = int.Parse(strChargeAmount + "000"); //model.ChargeIP = strIP; //model.State = 0; DAL.SYS.SYSDictionaryDAL dicDal = new DAL.SYS.SYSDictionaryDAL(); DAL.MiniShop.MSShoppingCartDAL dal = new MSShoppingCartDAL(); string strPID = "VH20141104210211"; string strCType = "话费充值"; if (strChargeType == "Q币充值") { strCType = "qbcz"; strPID = "VQ20141104210212"; strDiscount = dicDal.GetDictionaryValues("WXCZ_QB"); } else { strCType = "hfcz"; strPID = "VH20141104210211"; switch (strCelWhere) { case "CMCC": strDiscount = dicDal.GetDictionaryValues("WXCZ_YD"); break; case "CT": strDiscount = dicDal.GetDictionaryValues("WXCZ_DX"); break; case "CU": strDiscount = dicDal.GetDictionaryValues("WXCZ_LT"); break; default: strDiscount = "100"; break; } } string strOrderID = dal.SubVirtualProductOrder(strOpenID, strCustNo, strPID, strChargeAmount); if (!string.IsNullOrEmpty(strOrderID)) { WXJSAPIPay wxpay = new WXJSAPIPay("VYIGO"); wxpay.DirectWXJSAPIPay(this.Response, strCType, strOrderID, int.Parse(strChargeAmount + "00") * int.Parse(strDiscount) / 100, strIP, strOpenID, "http://www.vgo2013.com/PalmShop/ShopCode/ChargeFeeOver.aspx", null, strCType + "|" + strCustNo + "|" + strChargeAmount); } else { } }
/// <summary> /// 把购物车添加到订单 /// </summary> void setAddOrder() { string uname = string.Empty; string uphone = string.Empty; string address = string.Empty; string payway = string.Empty; string carryway = string.Empty; string countcost = string.Empty; string leavemsg = string.Empty; string zipcode = string.Empty; string num = string.Empty; #region --------------获取请求信息--------------- if (Request["num"] != null && Request["num"] != "") { num = Request["num"]; } if (Request["uname"] != null && Request["uname"] != "") { uname = Common.Common.NoHtml(Request["uname"]); } if (Request["uphone"] != null && Request["uphone"] != "") { uphone = Common.Common.NoHtml(Request["uphone"]); } if (Request["address"] != null && Request["address"] != "") { address = Request["address"]; } if (Request["payway"] != null && Request["payway"] != "") { payway = Common.Common.NoHtml(Request["payway"]); } if (Request["carryway"] != null && Request["carryway"] != "") { carryway = Common.Common.NoHtml(Request["carryway"]); } if (Request["countcost"] != null && Request["countcost"] != "") { countcost = Common.Common.NoHtml(Request["countcost"]); } if (Request["leavemsg"] != null && Request["leavemsg"] != "") { leavemsg = Common.Common.NoHtml(Request["leavemsg"]); } if (Request["zipcode"] != null && Request["zipcode"] != "") { zipcode = Common.Common.NoHtml(Request["zipcode"]); } #endregion if (customid.Trim() != null && customid.Trim() != "") { MSShoppingCartDAL cartDal = new MSShoppingCartDAL(); MSProductOrderDAL OrderDal = new MSProductOrderDAL(); if (OrderDal.ExistOrderByUID(customid, strpid)) { Response.Write("{\"error\":true,\"exist\":true}"); } else { try { string strOrdernum = cartDal.SubOrder(customid, uname, uphone, leavemsg, address, zipcode, strpid, countcost, num, mid); if (strOrdernum != null && strOrdernum != "") { strSiteCode = "VYIGO"; MSOrderLogDAL.AddMSOrderLog("客户【" + customid + "】下单成功,订单号为【" + strOrdernum + "】"); MSProductDAL productDal = new MSProductDAL(); string pnam = string.Empty; if (strpid != null && strpid != "") { pnam = productDal.GetMSProductVaueByID("Ptitle", strpid).ToString(); } #region -发消息到店铺注册用户 string p_uid = string.Empty; string p_openid = string.Empty; if (strpid != null && strpid != "") { try { p_uid = productDal.GetMSProductVaueByID("CustomerID", strpid).ToString(); } catch (Exception) { } } if (p_uid != null && p_uid != "") { MSCustomersDAL P_UDal = new MSCustomersDAL(); try { p_openid = P_UDal.GetCustomerValueByID("OpenID", p_uid).ToString(); } catch (Exception) { } } if (p_openid != null && p_openid != "" && strSiteCode != null && strSiteCode != "") { JQDialog.SendWeiXinMsg(strSiteCode, p_openid, "亲爱的店长大人,您的宝贝【" + pnam + "】已于" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "被" + uname + "成功买下,单号【" + strOrdernum + "】赶紧去小店看看吧!"); } MSOrderLogDAL.AddMSOrderLog("下单成功,通知到OpenID为【" + p_openid + "】的店长"); #endregion #region -产品属性 MSProductParaDAL paraDal = new MSProductParaDAL(); int stock = 0; if (paraDal.ExistMSPPara("", strpid) && mid != null && mid != "") { try { stock = int.Parse(paraDal.GetMSPParaValueByID("Stock", mid).ToString()); } catch (Exception) { } if (stock > 0) { int buynum = 0; try { buynum = Convert.ToInt32(quantity); } catch (Exception) { } if (buynum != 0 && buynum < stock) { stock = stock - buynum; paraDal.UpdateStock(stock, mid); } } } #endregion DataSet orderds = cartDal.GetMyOrderDetail(strOrdernum); string payinfo = string.Empty; string productname = string.Empty; //用户购买的商品名称 string ordernum = string.Empty; //订单号 if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0) { productname = orderds.Tables[0].Rows[0]["Ptitle"].ToString(); ordernum = orderds.Tables[0].Rows[0]["ID"].ToString(); //payinfo= WapPayHelper.BuildRequest(productname, ordernum, countcost, customid); } if (productname.Trim() != null && productname.Trim() != "" && ordernum != null && ordernum != "") { //Response.Write("{\"success\":true,\"payinfo\":\"" + payinfo + "\"}"); Response.Write("{\"success\":true,\"pname\":\"" + productname + "\",\"ordernum\":\"" + ordernum + "\",\"countcost\":\"" + countcost + "\",\"customid\":\"" + customid + "\",\"openid\":\"" + openid + "\"}"); } } else { Response.Write("{\"error\":true,\"msg\":\"操作失败,重新操作\"}"); } } catch (Exception) { Response.Write("{\"error\":true,\"msg\":\"操作失败,重新操作\"}"); } } } else { setCookies(); Response.Write("{\"error\":true,\"msg\":\"操作失败,请登录后再操作\",\"loginurl\":\"UserLogin.aspx\"}"); } Response.End(); }
/// <summary> /// 获取订单处理信息 /// </summary> void GetOrderHandleList() { string oid = string.Empty;//支付成功返回订单 if (Request["oid"] != null && Request["oid"] != "") { oid = Common.Common.NoHtml(Request["oid"]); } List <OrderModel> orderlistModel = new List <OrderModel>(); if (customerid.Trim() != null && customerid.Trim() != "") { #region 获取产品列表 MSShoppingCartDAL orderlistDal = new MSShoppingCartDAL(); string orderstate = string.Empty; string where = string.Empty; string paystate = string.Empty; string receive = string.Empty; if (Request["orderstate"] != null && Request["orderstate"] != "") { orderstate = Common.Common.NoHtml(Request["orderstate"]); } if (Request["paystate"] != null && Request["paystate"] != "") { paystate = Common.Common.NoHtml(Request["paystate"]); } if (Request["receive"] != null && Request["receive"] != "") { receive = Common.Common.NoHtml(Request["receive"]); } where = " and a.CustomerID='" + customerid + "' "; if (orderstate.Trim() != null && orderstate.Trim() != "") { where += " and OrderState=" + orderstate; } else { where += " and OrderState=0 "; } if (paystate.Trim() != null && paystate.Trim() != "") { where += " and PayState=" + paystate; } else { where += " and PayState=0 "; } if (receive.Trim() != null && receive.Trim() != "") { where += " and IsReceive=" + receive; } else { where += " and IsReceive=0 "; } if (oid.Trim() != null && oid.Trim() != "") { where += " and a.ID='" + oid + "' "; } DataSet orderds = orderlistDal.GetMyOrderListByWhere(where); if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0) { foreach (DataRow row in orderds.Tables[0].Rows) { OrderModel orderModel = DataConvert.DataRowToModel <OrderModel>(row); orderlistModel.Add(orderModel); } } #endregion } string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/OrderHandle.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = "订单处理"; context.TempData["errorscript"] = errorscript; context.TempData["productlist"] = orderlistModel; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }