/// <summary> /// 绑定数据 /// </summary> private void BindData() { #region 生成订单 UserInfo user = Session["user"] as UserInfo; if (user != null) { OrderInfo order = new OrderInfo(); order.orderNo = ""; order.orderName = user.relName + "在Plate-X订单"; order.proTotal = 0; order.sendTotal = 0; order.orderTotal = 0; double total = 0; DataSet ds = CartTempService.GetList("addUser = "******"remark"]); } } order.orderTotal = Math.Round(total, 2); order.orderDesc = ""; order.remark = order.orderName + ",订单日期:" + DateTime.Now.ToString("yyyy-MM-dd"); order.recieveUser = user.relName; order.pid = 0; order.cid = 0; order.regionId = 0; order.PName = ""; order.CName = ""; order.ReginName = ""; order.address = ""; order.mobile = user.mobile; order.tel = ""; order.status = 0; order.addTime = DateTime.Now; order.infoType = 0; order.addUser = user.id; int maxId = OrderService.Add(order); order.orderNo = maxId + DateTime.Now.ToString("yyyyMd") + DateTime.Now.ToString("hhmmss"); int rows = OrderService.UpdateOrderNo(maxId, order.orderNo, order.orderDesc); if (rows > 0) { #region 订单详细 if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { int pid = Convert.ToInt32(ds.Tables[0].Rows[i]["productId"]); int count = Convert.ToInt32(ds.Tables[0].Rows[i]["productCount"]); #region 订单详细 Product item = ProductService.GetModel(pid); if (item != null) { #region 订单详细表 OrderDetail od = new OrderDetail(); od.orderId = maxId; od.orderNo = order.orderNo; od.productId = pid; od.productCount = count; od.isActive = 0; od.activeCode = ""; od.activeMoney = 0; od.total = Convert.ToDouble(ds.Tables[0].Rows[i]["remark"]); od.satus = 0; od.remark = ""; od.infoType = 0; OrderDetailService.Add(od); #endregion //清空临时表信息 CartTempService.DeleteByUserId(user.id, pid); } #endregion } } #endregion } Response.Redirect("/zhifu_" + maxId + ".html"); } #endregion }
/// <summary> /// 绑定数据 /// </summary> private void BindData() { #region 生成订单 UserInfo user = Session["user"] as UserInfo; if (user != null) { OrderInfo order = new OrderInfo(); order.orderNo = ""; order.orderName = user.relName + "在Plate-X订单"; order.proTotal = 0; order.sendTotal = 0; order.orderTotal = 0; double total = 0; DataSet ds = CartTempService.GetList("addUser = "******"remark"]); } } order.orderTotal = Math.Round(total, 2); order.orderDesc = ""; order.remark = order.orderName + ",订单日期:" + DateTime.Now.ToString("yyyy-MM-dd"); order.recieveUser = user.relName; order.pid = 0; order.cid = 0; order.regionId = 0; order.PName = ""; order.CName = ""; order.ReginName = ""; order.address = ""; order.mobile = user.mobile; order.tel = ""; order.status = 0; order.addTime = DateTime.Now; order.infoType = 0; order.addUser = user.id; int maxId = OrderService.Add(order); //生成二维码: //string ranStr = Rand.GetMixPwd(10); //string websiteUrl = BaseConfigService.GetById(12); //string userUrlStr = ""; // websiteUrl + "/mychat.aspx?orderId=" + maxId; //weixin://wxpay/bizpayurl?appid=wx8a02513b182f68af&mch_id=1372977102&nonce_str=" + ranStr + "&product_id=" + maxId + "&time_stamp=" + DateTime.Now.ToString("yyyyMMddhhmm") + "&sign= string url = "";// create_two(userUrlStr, maxId); order.orderDesc = url; order.orderNo = maxId + DateTime.Now.ToString("yyyyMMdd") + user.id + DateTime.Now.ToString("hhmmss"); int rows = OrderService.UpdateOrderNo(maxId, order.orderNo, order.orderDesc); if (rows > 0) { #region 订单详细 if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { int productId = Convert.ToInt32(dr["productId"]); Product item = ProductService.GetModel(productId); if (item != null) { #region 订单详细表 OrderDetail od = new OrderDetail(); od.orderId = maxId; od.orderNo = order.orderNo; od.productId = productId; od.productCount = Convert.ToInt32(dr["productCount"]); od.isActive = 0; od.activeCode = ""; od.activeMoney = 0; od.total = Convert.ToDouble(dr["remark"]); od.satus = 0; od.remark = ""; od.infoType = 0; OrderDetailService.Add(od); #endregion //清空临时表信息 CartTempService.DeleteByUserId(user.id, productId); } } } #endregion } Response.Redirect("orders_99.html"); } #endregion }