protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "") { string orderid = Request.QueryString["id"].ToString(); order= obll.getOrdersViewModel(int.Parse(orderid)); this.customer_name.Text = order.Username; this.sales_orderid.Text = order.OrderNo; this.customer_address.Text = order.Address; //查询详细客户信息 c= cb.GetModel(int.Parse(order.Customerid.ToString())); this.customer_linker.Text = c.link_men; this.customer_tel.Text = order.Tel + "/" + order.Mobile; this.customet_email.Text = c.email; //查询详细物流公司信息 tbLogs logs=new tbLogs(); tbLogsBLL tblogbll=new tbLogsBLL(); if (order.Logid != null) { logs = tblogbll.tbLogs_GetModel(order.Logid.ToString()); this.logistics.Text = logs.LogisticsName; this.logistics_num.Text = order.LogNumber; } this.state.Text = order.StateName; this.create_date.Text = DateTime.Parse(order.createdate.ToString()).ToString("yyyy-MM-dd"); attach_pay.Text =decimal.Parse(order.Postmoney.ToString()).ToString("0.00"); dt = sql.getDataByCondition("dbo.OrdersPro_View", "*", " OrderID="+order.OrderID); } }
protected void imgorder_Click(object sender, ImageClickEventArgs e) { OrderBLL orderbll = new OrderBLL(); tbOrders orders = new tbOrders() { Address = txtAddress.Text.Trim(), createdate = DateTime.Now, Customerid = int.Parse(Session["Cid"].ToString()), Mobile = txtMobile.Text.Trim(), Tel = txtTel.Text.Trim(), Postmoney = decimal.Parse(txtPostMoney.Text.Trim()), totalMoney = decimal.Parse(txtGoodsMoney.Text.Trim()) + decimal.Parse(txtPostMoney.Text.Trim()), Username = lbCustomer.Text, salesincome = decimal.Parse(txtGoodsMoney.Text.Trim()), sendUser = txtRealName.Text, remark = "" }; int ordersid= orderbll.tbOrders_ADD(orders); int count= orderbll.setorderprosbycid(int.Parse(Session["Cid"].ToString()), ordersid); int cartcount= sqlcom.UpdateTableByCondition("dbo.TbCat", " isOrders=1 ", " where isOrders=0 and Customerid=" + Session["Cid"].ToString()); int ccount= sqlcom.UpdateTableByCondition("dbo.tbCustomer", "c_name='" + txtRealName.Text.Trim() + "',tel='" + orders.Tel + "',mobile='" + orders.Mobile + "',email='" + txtEmail.Text + "',link_men='" + txtOthors.Text + "',address='" + txtAddress.Text + "'", " where id=" + Session["Cid"].ToString()); if (ordersid == 0 || count == 0 || cartcount == 0 || ccount == 0) { ContextUtil.SetAbort(); } else { ContextUtil.SetComplete(); Response.Redirect("PayWay.aspx?OrderID=" + ordersid); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["id"] != null) { this.ddllogs.DataSource = comm.getDataByCondition("tbLogs", "ID,LogisticsName", null); this.ddllogs.DataTextField = "LogisticsName"; this.ddllogs.DataValueField = "ID"; this.ddllogs.DataBind(); this.ddllogs.Items.Add(new System.Web.UI.WebControls.ListItem("请选择","0")); this.ddllogs.SelectedValue = "0"; string id = Request.QueryString["id"].ToString(); orders = obll.getOrdersViewModel(int.Parse(id)); if (orders.Logid.ToString() != "" && orders.Logid.ToString() != "0") { this.ddllogs.SelectedValue = orders.Logid.ToString(); } this.ddlState.SelectedValue = orders.State.ToString(); this.txtSendUser.Text = orders.sendUser; this.txtRemark.Text = orders.remark; } else { Response.Redirect("OrdersList.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["OrderID"] != null) { string orderid = Request.QueryString["OrderID"].ToString(); tbOrders order = new tbOrders(); OrderBLL orderbll = new OrderBLL(); order= orderbll.getOrdersViewModel(int.Parse(orderid)); bankpay.Orderid= order.OrderNo;//订单编号 bankpay.Amount = order.totalMoney.ToString();//订单金额 bankpay.OrderDate = order.createdate.ToString();//订单日期 bankpay.Path1 = Server.MapPath(@"bank\user.crt");//拆分pfx后缀的证书后的公钥路径 bankpay.Path2 = Server.MapPath(@"bank\user.crt"); bankpay.Path3 = Server.MapPath(@"bank\user.key");//拆分pfx后缀的证书后的私钥路径 //加密 bankpay.Msg = bankpay.InterfaceName + bankpay.InterfaceVersion + bankpay.MerID + bankpay.MerAcct + bankpay.MerURL + bankpay.NotifyType + bankpay.Orderid + bankpay + bankpay.Amount + bankpay.CurType + bankpay.ResultType + bankpay.OrderDate + bankpay.VerifyJoinFlag; ICBCEBANKUTILLib.B2CUtil obj = new ICBCEBANKUTILLib.B2CUtil(); //加载公钥,私玥,密码,如果返回的0则成功 if (obj.init(bankpay.Path1, bankpay.Path2, bankpay.Path3, bankpay.Key) == 0) { bankpay.MerSignMsg = obj.signC(bankpay.Msg, bankpay.Msg.Length); bankpay.MerCert = obj.getCert(1); } else { Response.Write(obj.getRC()); } } }
/// <summary> /// 通过订单编号返回订单视图对象 /// </summary> /// <param name="orderid"></param> /// <returns></returns> public tbOrders getOrdersViewModel(int orderid) { SqlParameter[] pars = new SqlParameter[]{ new SqlParameter("@OrderID",orderid) }; DataSet ds= dbhelper.ExcuteSelectReturnDataSet("tbOrders_GetModel", CommandType.StoredProcedure, pars); tbOrders model = new tbOrders(); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["OrderID"].ToString() != "") { model.OrderID = int.Parse(ds.Tables[0].Rows[0]["OrderID"].ToString()); } model.OrderNo = ds.Tables[0].Rows[0]["OrderNo"].ToString(); if (ds.Tables[0].Rows[0]["Customerid"].ToString() != "") { model.Customerid = int.Parse(ds.Tables[0].Rows[0]["Customerid"].ToString()); } model.Address = ds.Tables[0].Rows[0]["Address"].ToString(); if (ds.Tables[0].Rows[0]["totalMoney"].ToString() != "") { model.totalMoney = decimal.Parse(ds.Tables[0].Rows[0]["totalMoney"].ToString()); } if (ds.Tables[0].Rows[0]["Postmoney"].ToString() != "") { model.Postmoney = decimal.Parse(ds.Tables[0].Rows[0]["Postmoney"].ToString()); } if (ds.Tables[0].Rows[0]["Logid"].ToString() != "") { model.Logid = int.Parse(ds.Tables[0].Rows[0]["Logid"].ToString()); } model.LogNumber = ds.Tables[0].Rows[0]["LogNumber"].ToString(); model.auditinguser = ds.Tables[0].Rows[0]["auditinguser"].ToString(); if (ds.Tables[0].Rows[0]["salesincome"].ToString() != "") { model.salesincome = decimal.Parse(ds.Tables[0].Rows[0]["salesincome"].ToString()); } if (ds.Tables[0].Rows[0]["userid"].ToString() != "") { model.userid = int.Parse(ds.Tables[0].Rows[0]["userid"].ToString()); } if (ds.Tables[0].Rows[0]["createdate"].ToString() != "") { model.createdate = DateTime.Parse(ds.Tables[0].Rows[0]["createdate"].ToString()); } model.remark = ds.Tables[0].Rows[0]["remark"].ToString(); model.sendUser = ds.Tables[0].Rows[0]["sendUser"].ToString(); if (ds.Tables[0].Rows[0]["state"].ToString() != "") { model.State = int.Parse(ds.Tables[0].Rows[0]["state"].ToString()); } model.Username = ds.Tables[0].Rows[0]["username"].ToString(); model.Tel = ds.Tables[0].Rows[0]["tel"].ToString(); model.Mobile = ds.Tables[0].Rows[0]["mobile"].ToString(); model.StateName = ds.Tables[0].Rows[0]["stateName"].ToString(); return model; } else { return null; } }
/// <summary> /// 订单基本信息添加 /// </summary> /// <param name="model"></param> /// <returns></returns> public int tbOrders_ADD(tbOrders model) { SqlParameter[] pars = new SqlParameter[]{ new SqlParameter("@OrderID",SqlDbType.Int,4), new SqlParameter("@Customerid",model.Customerid), new SqlParameter("@Address",model.Address), new SqlParameter("@totalMoney",model.totalMoney), new SqlParameter("@Postmoney",model.Postmoney), new SqlParameter("@salesincome",model.salesincome), new SqlParameter("@createdate",model.createdate), new SqlParameter("@remark",model.remark) }; pars[0].Direction = ParameterDirection.Output; int count= dbhelper.ExcuteCommandReturnInt("tbOrders_ADD", CommandType.StoredProcedure, pars); if (count != 0) { return int.Parse(pars[0].Value.ToString()); } else { return 0; } }