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); } }
/// <summary> /// 修改业务方法封装 /// </summary> /// <param name="model"></param> /// <returns></returns> public int tbLogs_Update(tbLogs model) { SqlParameter[] pars = new SqlParameter[]{ new SqlParameter("@ID",model.ID), new SqlParameter("@LogisticsName",model.LogisticsName), new SqlParameter("@Address",model.Address), new SqlParameter("@LinkMan",model.LinkMan), new SqlParameter("@Tel",model.Tel), new SqlParameter("@Mobile",model.Mobile) }; return sqlhelper.ExcuteCommandReturnInt("tbLogs_Update", CommandType.StoredProcedure, pars); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["id"] != null) { string id = Request.QueryString["id"].ToString(); logs = logsbll.tbLogs_GetModel(id); this.txtAddress.Text = logs.Address; this.txtLinkMan.Text = logs.LinkMan; this.txtLogsName.Text = logs.LogisticsName; this.txtMobie.Text = logs.Mobile; this.txtTel.Text = logs.Tel; } else { Response.Redirect("logsList.aspx"); } } }
/// <summary> /// 获取详细对象 /// </summary> /// <param name="id"></param> /// <returns></returns> public tbLogs tbLogs_GetModel(string id) { SqlParameter[] pars = new SqlParameter[]{ new SqlParameter("@ID",int.Parse(id)) }; SqlDataReader reader= sqlhelper.SelectSqlReturnDataReader("tbLogs_GetModel", CommandType.StoredProcedure, pars); tbLogs logs = new tbLogs(); if (reader.Read()) { logs.ID =int.Parse(reader["ID"].ToString()); logs.LogisticsName = reader["LogisticsName"].ToString(); logs.Mobile = reader["Mobile"].ToString(); logs.Tel = reader["Tel"].ToString(); logs.LinkMan = reader["LinkMan"].ToString(); logs.Address = reader["Address"].ToString(); } reader.Close(); return logs; }
protected void btnSave_Click(object sender, EventArgs e) { tbLogs logs = new tbLogs() { Address = txtAddress.Text, LinkMan = txtLinkMan.Text, LogisticsName = txtLogsName.Text, Mobile = txtMobie.Text, Tel = txtTel.Text }; tbLogsBLL logsbll = new tbLogsBLL(); int count= logsbll.tbLogs_ADD(logs); if (count != 0) { Response.Redirect("logsList.aspx"); } else { ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('添加失败')", true); } }
/// <summary> /// 物流公司信息添加业务 /// </summary> /// <param name="model">tbLogs对象</param> /// <returns>int</returns> public int tbLogs_ADD(tbLogs model) { SqlParameter[] pars = new SqlParameter[]{ new SqlParameter("@ID",SqlDbType.Int,4), new SqlParameter("@LogisticsName",model.LogisticsName), new SqlParameter("@Address",model.Address), new SqlParameter("@LinkMan",model.LinkMan), new SqlParameter("@Tel",model.Tel), new SqlParameter("@Mobile",model.Mobile) }; pars[0].Direction = ParameterDirection.Output; int count= sqlhelper.ExcuteCommandReturnInt("tbLogs_ADD", CommandType.StoredProcedure, pars); if (count != 0) { return int.Parse(pars[0].Value.ToString()); } else { return 0; } }