/// <summary> /// 将对象转换实体 /// </summary> public Model.orders DataRowToModel(DataRow row) { Model.orders model = new Model.orders(); if (row != null) { #region 主表信息====================== //利用反射获得属性的所有公共属性 Type modelType = model.GetType(); for (int i = 0; i < row.Table.Columns.Count; i++) { //查找实体是否存在列表相同的公共属性 PropertyInfo proInfo = modelType.GetProperty(row.Table.Columns[i].ColumnName); if (proInfo != null && row[i] != DBNull.Value) { proInfo.SetValue(model, row[i], null);//用索引值设置属性值 } } #endregion #region 子表信息====================== StringBuilder strSql1 = new StringBuilder(); strSql1.Append("select * from " + databaseprefix + "order_goods"); strSql1.Append(" where order_id=@id"); SqlParameter[] parameters1 = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters1[0].Value = model.id; DataTable dt1 = DbHelperSQL.Query(strSql1.ToString(), parameters1).Tables[0]; if (dt1.Rows.Count > 0) { int rowsCount = dt1.Rows.Count; List <Model.order_goods> models = new List <Model.order_goods>(); Model.order_goods modelt; for (int n = 0; n < rowsCount; n++) { modelt = new Model.order_goods(); Type modeltType = modelt.GetType(); for (int i = 0; i < dt1.Rows[n].Table.Columns.Count; i++) { PropertyInfo proInfo = modeltType.GetProperty(dt1.Rows[n].Table.Columns[i].ColumnName); if (proInfo != null && dt1.Rows[n][i] != DBNull.Value) { proInfo.SetValue(modelt, dt1.Rows[n][i], null); } } models.Add(modelt); } model.order_goods = models; } #endregion } return(model); }
/// <summary> /// 莉坝珇э跑肂 /// </summary> public decimal GetGoodsChangeAmount(string id, int num) { StringBuilder strSql2 = new StringBuilder(); strSql2.Append("select * from " + databaseprefix + "order_goods "); strSql2.Append(" where id=@id "); SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters2[0].Value = id; decimal amount = 0; decimal afteramount = 0; DataSet ds = DbHelperSQL.Query(strSql2.ToString(), parameters2); if (ds.Tables[0].Rows.Count > 0) { int i = ds.Tables[0].Rows.Count; Model.order_goods modelt; for (int n = 0; n < i; n++) { modelt = new Model.order_goods(); if (ds.Tables[0].Rows[n]["real_price"] != null && ds.Tables[0].Rows[n]["real_price"].ToString() != "") { modelt.real_price = decimal.Parse(ds.Tables[0].Rows[n]["real_price"].ToString()); } if (ds.Tables[0].Rows[n]["quantity"] != null && ds.Tables[0].Rows[n]["quantity"].ToString() != "") { modelt.quantity = int.Parse(ds.Tables[0].Rows[n]["quantity"].ToString()); } amount = modelt.real_price * modelt.quantity; afteramount = modelt.real_price * num; } return(afteramount - amount); } else { return(0); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.order_goods DataRowToModel(DataRow row) { Model.order_goods model = new Model.order_goods(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["order_id"] != null && row["order_id"].ToString() != "") { model.order_id = int.Parse(row["order_id"].ToString()); } if (row["goods_id"] != null && row["goods_id"].ToString() != "") { model.goods_id = int.Parse(row["goods_id"].ToString()); } if (row["goods_name"] != null) { model.goods_name = row["goods_name"].ToString(); } if (row["goods_price"] != null && row["goods_price"].ToString() != "") { model.goods_price = decimal.Parse(row["goods_price"].ToString()); } if (row["real_price"] != null && row["real_price"].ToString() != "") { model.real_price = decimal.Parse(row["real_price"].ToString()); } if (row["quantity"] != null && row["quantity"].ToString() != "") { model.quantity = int.Parse(row["quantity"].ToString()); } if (row["point"] != null && row["point"].ToString() != "") { model.point = int.Parse(row["point"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.order_goods Getorder_goodsModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,order_id,goods_id,goods_name,goods_price,real_price,quantity,point from dt_order_goods "); strSql.Append(" where order_id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.order_goods model = new Model.order_goods(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// �õ�һ������ʵ�� /// </summary> public Model.orders GetModel(int id) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 id,order_no,user_id,user_name,payment_id,distribution_id,status,payment_status,distribution_status,delivery_name,delivery_no,accept_name,post_code,telphone,mobile,address,message,payable_amount,real_amount,payable_freight,real_freight,payment_fee,order_amount,point,add_time,payment_time,confirm_time,distribution_time,complete_time from dt_orders "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4)}; parameters[0].Value = id; Model.orders model=new Model.orders(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { #region ������Ϣ if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } if (ds.Tables[0].Rows[0]["order_no"] != null && ds.Tables[0].Rows[0]["order_no"].ToString() != "") { model.order_no = ds.Tables[0].Rows[0]["order_no"].ToString(); } if (ds.Tables[0].Rows[0]["user_id"] != null && ds.Tables[0].Rows[0]["user_id"].ToString() != "") { model.user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString()); } if (ds.Tables[0].Rows[0]["user_name"] != null && ds.Tables[0].Rows[0]["user_name"].ToString() != "") { model.user_name = ds.Tables[0].Rows[0]["user_name"].ToString(); } if (ds.Tables[0].Rows[0]["payment_id"] != null && ds.Tables[0].Rows[0]["payment_id"].ToString() != "") { model.payment_id = int.Parse(ds.Tables[0].Rows[0]["payment_id"].ToString()); } if (ds.Tables[0].Rows[0]["distribution_id"] != null && ds.Tables[0].Rows[0]["distribution_id"].ToString() != "") { model.distribution_id = int.Parse(ds.Tables[0].Rows[0]["distribution_id"].ToString()); } if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "") { model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString()); } if (ds.Tables[0].Rows[0]["payment_status"] != null && ds.Tables[0].Rows[0]["payment_status"].ToString() != "") { model.payment_status = int.Parse(ds.Tables[0].Rows[0]["payment_status"].ToString()); } if (ds.Tables[0].Rows[0]["distribution_status"] != null && ds.Tables[0].Rows[0]["distribution_status"].ToString() != "") { model.distribution_status = int.Parse(ds.Tables[0].Rows[0]["distribution_status"].ToString()); } if (ds.Tables[0].Rows[0]["delivery_name"] != null && ds.Tables[0].Rows[0]["delivery_name"].ToString() != "") { model.delivery_name = ds.Tables[0].Rows[0]["delivery_name"].ToString(); } if (ds.Tables[0].Rows[0]["delivery_no"] != null && ds.Tables[0].Rows[0]["delivery_no"].ToString() != "") { model.delivery_no = ds.Tables[0].Rows[0]["delivery_no"].ToString(); } if (ds.Tables[0].Rows[0]["accept_name"] != null && ds.Tables[0].Rows[0]["accept_name"].ToString() != "") { model.accept_name = ds.Tables[0].Rows[0]["accept_name"].ToString(); } if (ds.Tables[0].Rows[0]["post_code"] != null && ds.Tables[0].Rows[0]["post_code"].ToString() != "") { model.post_code = ds.Tables[0].Rows[0]["post_code"].ToString(); } if (ds.Tables[0].Rows[0]["telphone"] != null && ds.Tables[0].Rows[0]["telphone"].ToString() != "") { model.telphone = ds.Tables[0].Rows[0]["telphone"].ToString(); } if (ds.Tables[0].Rows[0]["mobile"] != null && ds.Tables[0].Rows[0]["mobile"].ToString() != "") { model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString(); } if (ds.Tables[0].Rows[0]["address"] != null && ds.Tables[0].Rows[0]["address"].ToString() != "") { model.address = ds.Tables[0].Rows[0]["address"].ToString(); } if (ds.Tables[0].Rows[0]["message"] != null && ds.Tables[0].Rows[0]["message"].ToString() != "") { model.message = ds.Tables[0].Rows[0]["message"].ToString(); } if (ds.Tables[0].Rows[0]["payable_amount"] != null && ds.Tables[0].Rows[0]["payable_amount"].ToString() != "") { model.payable_amount = decimal.Parse(ds.Tables[0].Rows[0]["payable_amount"].ToString()); } if (ds.Tables[0].Rows[0]["real_amount"] != null && ds.Tables[0].Rows[0]["real_amount"].ToString() != "") { model.real_amount = decimal.Parse(ds.Tables[0].Rows[0]["real_amount"].ToString()); } if (ds.Tables[0].Rows[0]["payable_freight"] != null && ds.Tables[0].Rows[0]["payable_freight"].ToString() != "") { model.payable_freight = decimal.Parse(ds.Tables[0].Rows[0]["payable_freight"].ToString()); } if (ds.Tables[0].Rows[0]["real_freight"] != null && ds.Tables[0].Rows[0]["real_freight"].ToString() != "") { model.real_freight = decimal.Parse(ds.Tables[0].Rows[0]["real_freight"].ToString()); } if (ds.Tables[0].Rows[0]["payment_fee"] != null && ds.Tables[0].Rows[0]["payment_fee"].ToString() != "") { model.payment_fee = decimal.Parse(ds.Tables[0].Rows[0]["payment_fee"].ToString()); } if (ds.Tables[0].Rows[0]["order_amount"] != null && ds.Tables[0].Rows[0]["order_amount"].ToString() != "") { model.order_amount = decimal.Parse(ds.Tables[0].Rows[0]["order_amount"].ToString()); } if (ds.Tables[0].Rows[0]["point"] != null && ds.Tables[0].Rows[0]["point"].ToString() != "") { model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString()); } if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "") { model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString()); } if (ds.Tables[0].Rows[0]["payment_time"] != null && ds.Tables[0].Rows[0]["payment_time"].ToString() != "") { model.payment_time = DateTime.Parse(ds.Tables[0].Rows[0]["payment_time"].ToString()); } if (ds.Tables[0].Rows[0]["confirm_time"] != null && ds.Tables[0].Rows[0]["confirm_time"].ToString() != "") { model.confirm_time = DateTime.Parse(ds.Tables[0].Rows[0]["confirm_time"].ToString()); } if (ds.Tables[0].Rows[0]["distribution_time"] != null && ds.Tables[0].Rows[0]["distribution_time"].ToString() != "") { model.distribution_time = DateTime.Parse(ds.Tables[0].Rows[0]["distribution_time"].ToString()); } if (ds.Tables[0].Rows[0]["complete_time"] != null && ds.Tables[0].Rows[0]["complete_time"].ToString() != "") { model.complete_time = DateTime.Parse(ds.Tables[0].Rows[0]["complete_time"].ToString()); } #endregion ������Ϣend #region �ӱ���Ϣ StringBuilder strSql2=new StringBuilder(); strSql2.Append("select id,order_id,goods_id,goods_name,goods_price,real_price,quantity,point from dt_order_goods "); strSql2.Append(" where order_id=@id "); SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int,4)}; parameters2[0].Value = id; DataSet ds2=DbHelperSQL.Query(strSql2.ToString(),parameters2); if(ds2.Tables[0].Rows.Count>0) { #region �ӱ��ֶ���Ϣ int i = ds2.Tables[0].Rows.Count; List<Model.order_goods> models = new List<Model.order_goods>(); Model.order_goods modelt; for (int n = 0; n < i; n++) { modelt = new Model.order_goods(); if(ds2.Tables[0].Rows[n]["id"]!=null && ds2.Tables[0].Rows[n]["id"].ToString()!="") { modelt.id=int.Parse(ds2.Tables[0].Rows[n]["id"].ToString()); } if(ds2.Tables[0].Rows[n]["order_id"]!=null && ds2.Tables[0].Rows[n]["order_id"].ToString()!="") { modelt.order_id=int.Parse(ds2.Tables[0].Rows[n]["order_id"].ToString()); } if(ds2.Tables[0].Rows[n]["goods_id"]!=null && ds2.Tables[0].Rows[n]["goods_id"].ToString()!="") { modelt.goods_id=int.Parse(ds2.Tables[0].Rows[n]["goods_id"].ToString()); } if(ds2.Tables[0].Rows[n]["goods_name"]!=null && ds2.Tables[0].Rows[n]["goods_name"].ToString()!="") { modelt.goods_name=ds2.Tables[0].Rows[n]["goods_name"].ToString(); } if(ds2.Tables[0].Rows[n]["goods_price"]!=null && ds2.Tables[0].Rows[n]["goods_price"].ToString()!="") { modelt.goods_price=decimal.Parse(ds2.Tables[0].Rows[n]["goods_price"].ToString()); } if(ds2.Tables[0].Rows[n]["real_price"]!=null && ds2.Tables[0].Rows[n]["real_price"].ToString()!="") { modelt.real_price=decimal.Parse(ds2.Tables[0].Rows[n]["real_price"].ToString()); } if(ds2.Tables[0].Rows[n]["quantity"]!=null && ds2.Tables[0].Rows[n]["quantity"].ToString()!="") { modelt.quantity=int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString()); } if(ds2.Tables[0].Rows[n]["point"]!=null && ds2.Tables[0].Rows[n]["point"].ToString()!="") { modelt.point=int.Parse(ds2.Tables[0].Rows[n]["point"].ToString()); } models.Add(modelt); } model.order_goods = models; #endregion �ӱ��ֶ���Ϣend } #endregion �ӱ���Ϣend return model; } else { return null; } }
private void ShowInfo(int _id) { BLL.orders bll = new BLL.orders(); model = bll.GetModelGoods(_id); }
/// <summary> /// 将对象转换为实体 /// </summary> public Model.orders DataRowToModel(DataRow row) { Model.orders model = new Model.orders(); if (row != null) { #region 主表信息 if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["order_no"] != null) { model.order_no = row["order_no"].ToString(); } if (row["trade_no"] != null) { model.trade_no = row["trade_no"].ToString(); } if (row["user_id"] != null && row["user_id"].ToString() != "") { model.user_id = int.Parse(row["user_id"].ToString()); } if (row["user_name"] != null) { model.user_name = row["user_name"].ToString(); } if (row["payment_id"] != null && row["payment_id"].ToString() != "") { model.payment_id = int.Parse(row["payment_id"].ToString()); } if (row["payment_fee"] != null && row["payment_fee"].ToString() != "") { model.payment_fee = decimal.Parse(row["payment_fee"].ToString()); } if (row["payment_status"] != null && row["payment_status"].ToString() != "") { model.payment_status = int.Parse(row["payment_status"].ToString()); } if (row["payment_time"] != null && row["payment_time"].ToString() != "") { model.payment_time = DateTime.Parse(row["payment_time"].ToString()); } if (row["express_id"] != null && row["express_id"].ToString() != "") { model.express_id = int.Parse(row["express_id"].ToString()); } if (row["express_no"] != null) { model.express_no = row["express_no"].ToString(); } if (row["express_fee"] != null && row["express_fee"].ToString() != "") { model.express_fee = decimal.Parse(row["express_fee"].ToString()); } if (row["express_status"] != null && row["express_status"].ToString() != "") { model.express_status = int.Parse(row["express_status"].ToString()); } if (row["express_time"] != null && row["express_time"].ToString() != "") { model.express_time = DateTime.Parse(row["express_time"].ToString()); } if (row["accept_name"] != null) { model.accept_name = row["accept_name"].ToString(); } if (row["post_code"] != null) { model.post_code = row["post_code"].ToString(); } if (row["telphone"] != null) { model.telphone = row["telphone"].ToString(); } if (row["mobile"] != null) { model.mobile = row["mobile"].ToString(); } if (row["email"] != null) { model.email = row["email"].ToString(); } if (row["area"] != null) { model.area = row["area"].ToString(); } if (row["address"] != null) { model.address = row["address"].ToString(); } if (row["message"] != null) { model.message = row["message"].ToString(); } if (row["remark"] != null) { model.remark = row["remark"].ToString(); } if (row["is_invoice"] != null && row["is_invoice"].ToString() != "") { model.is_invoice = int.Parse(row["is_invoice"].ToString()); } if (row["invoice_title"] != null) { model.invoice_title = row["invoice_title"].ToString(); } if (row["invoice_taxes"] != null && row["invoice_taxes"].ToString() != "") { model.invoice_taxes = decimal.Parse(row["invoice_taxes"].ToString()); } if (row["payable_amount"] != null && row["payable_amount"].ToString() != "") { model.payable_amount = decimal.Parse(row["payable_amount"].ToString()); } if (row["real_amount"] != null && row["real_amount"].ToString() != "") { model.real_amount = decimal.Parse(row["real_amount"].ToString()); } if (row["order_amount"] != null && row["order_amount"].ToString() != "") { model.order_amount = decimal.Parse(row["order_amount"].ToString()); } if (row["point"] != null && row["point"].ToString() != "") { model.point = int.Parse(row["point"].ToString()); } if (row["status"] != null && row["status"].ToString() != "") { model.status = int.Parse(row["status"].ToString()); } if (row["add_time"] != null && row["add_time"].ToString() != "") { model.add_time = DateTime.Parse(row["add_time"].ToString()); } if (row["confirm_time"] != null && row["confirm_time"].ToString() != "") { model.confirm_time = DateTime.Parse(row["confirm_time"].ToString()); } if (row["complete_time"] != null && row["complete_time"].ToString() != "") { model.complete_time = DateTime.Parse(row["complete_time"].ToString()); } #endregion #region 子表信息 StringBuilder strSql2 = new StringBuilder(); strSql2.Append("select id,article_id,order_id,goods_no,goods_title,img_url,spec_text,goods_price,real_price,quantity,point"); strSql2.Append(" from " + databaseprefix + "order_goods "); strSql2.Append(" where order_id=@id "); OleDbParameter[] parameters2 = { new OleDbParameter("@id", OleDbType.Integer, 4) }; parameters2[0].Value = model.id; DataSet ds2 = DbHelperOleDb.Query(strSql2.ToString(), parameters2); if (ds2.Tables[0].Rows.Count > 0) { List <Model.order_goods> ls = new List <Model.order_goods>(); for (int n = 0; n < ds2.Tables[0].Rows.Count; n++) { Model.order_goods modelt = new Model.order_goods(); if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "") { modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString()); } if (ds2.Tables[0].Rows[n]["article_id"] != null && ds2.Tables[0].Rows[n]["article_id"].ToString() != "") { modelt.article_id = int.Parse(ds2.Tables[0].Rows[n]["article_id"].ToString()); } if (ds2.Tables[0].Rows[n]["order_id"] != null && ds2.Tables[0].Rows[n]["order_id"].ToString() != "") { modelt.order_id = int.Parse(ds2.Tables[0].Rows[n]["order_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_no"] != null) { modelt.goods_no = ds2.Tables[0].Rows[n]["goods_no"].ToString(); } if (ds2.Tables[0].Rows[n]["goods_title"] != null) { modelt.goods_title = ds2.Tables[0].Rows[n]["goods_title"].ToString(); } if (ds2.Tables[0].Rows[n]["img_url"] != null) { modelt.img_url = ds2.Tables[0].Rows[n]["img_url"].ToString(); } if (ds2.Tables[0].Rows[n]["spec_text"] != null) { modelt.spec_text = ds2.Tables[0].Rows[n]["spec_text"].ToString(); } if (ds2.Tables[0].Rows[n]["goods_price"] != null && ds2.Tables[0].Rows[n]["goods_price"].ToString() != "") { modelt.goods_price = decimal.Parse(ds2.Tables[0].Rows[n]["goods_price"].ToString()); } if (ds2.Tables[0].Rows[n]["real_price"] != null && ds2.Tables[0].Rows[n]["real_price"].ToString() != "") { modelt.real_price = decimal.Parse(ds2.Tables[0].Rows[n]["real_price"].ToString()); } if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "") { modelt.quantity = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString()); } if (ds2.Tables[0].Rows[n]["point"] != null && ds2.Tables[0].Rows[n]["point"].ToString() != "") { modelt.point = int.Parse(ds2.Tables[0].Rows[n]["point"].ToString()); } ls.Add(modelt); } model.order_goods = ls; } #endregion } return(model); }
/// <summary> /// ������ת��Ϊʵ�� /// </summary> public Model.orders DataRowToModel(DataRow row) { Model.orders model = new Model.orders(); if (row != null) { #region ������Ϣ if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["order_no"] != null) { model.order_no = row["order_no"].ToString(); } if (row["trade_no"] != null) { model.trade_no = row["trade_no"].ToString(); } if (row["user_id"] != null && row["user_id"].ToString() != "") { model.user_id = int.Parse(row["user_id"].ToString()); } if (row["user_name"] != null) { model.user_name = row["user_name"].ToString(); } if (row["payment_id"] != null && row["payment_id"].ToString() != "") { model.payment_id = int.Parse(row["payment_id"].ToString()); } if (row["payment_fee"] != null && row["payment_fee"].ToString() != "") { model.payment_fee = decimal.Parse(row["payment_fee"].ToString()); } if (row["payment_status"] != null && row["payment_status"].ToString() != "") { model.payment_status = int.Parse(row["payment_status"].ToString()); } if (row["payment_time"] != null && row["payment_time"].ToString() != "") { model.payment_time = DateTime.Parse(row["payment_time"].ToString()); } if (row["express_id"] != null && row["express_id"].ToString() != "") { model.express_id = int.Parse(row["express_id"].ToString()); } if (row["express_no"] != null) { model.express_no = row["express_no"].ToString(); } if (row["express_fee"] != null && row["express_fee"].ToString() != "") { model.express_fee = decimal.Parse(row["express_fee"].ToString()); } if (row["express_status"] != null && row["express_status"].ToString() != "") { model.express_status = int.Parse(row["express_status"].ToString()); } if (row["express_time"] != null && row["express_time"].ToString() != "") { model.express_time = DateTime.Parse(row["express_time"].ToString()); } if (row["accept_name"] != null) { model.accept_name = row["accept_name"].ToString(); } if (row["post_code"] != null) { model.post_code = row["post_code"].ToString(); } if (row["telphone"] != null) { model.telphone = row["telphone"].ToString(); } if (row["mobile"] != null) { model.mobile = row["mobile"].ToString(); } if (row["email"] != null) { model.email = row["email"].ToString(); } if (row["area"] != null) { model.area = row["area"].ToString(); } if (row["address"] != null) { model.address = row["address"].ToString(); } if (row["message"] != null) { model.message = row["message"].ToString(); } if (row["remark"] != null) { model.remark = row["remark"].ToString(); } if (row["is_invoice"] != null && row["is_invoice"].ToString() != "") { model.is_invoice = int.Parse(row["is_invoice"].ToString()); } if (row["invoice_title"] != null) { model.invoice_title = row["invoice_title"].ToString(); } if (row["invoice_taxes"] != null && row["invoice_taxes"].ToString() != "") { model.invoice_taxes = decimal.Parse(row["invoice_taxes"].ToString()); } if (row["payable_amount"] != null && row["payable_amount"].ToString() != "") { model.payable_amount = decimal.Parse(row["payable_amount"].ToString()); } if (row["real_amount"] != null && row["real_amount"].ToString() != "") { model.real_amount = decimal.Parse(row["real_amount"].ToString()); } if (row["order_amount"] != null && row["order_amount"].ToString() != "") { model.order_amount = decimal.Parse(row["order_amount"].ToString()); } if (row["point"] != null && row["point"].ToString() != "") { model.point = int.Parse(row["point"].ToString()); } if (row["status"] != null && row["status"].ToString() != "") { model.status = int.Parse(row["status"].ToString()); } if (row["add_time"] != null && row["add_time"].ToString() != "") { model.add_time = DateTime.Parse(row["add_time"].ToString()); } if (row["confirm_time"] != null && row["confirm_time"].ToString() != "") { model.confirm_time = DateTime.Parse(row["confirm_time"].ToString()); } if (row["complete_time"] != null && row["complete_time"].ToString() != "") { model.complete_time = DateTime.Parse(row["complete_time"].ToString()); } #endregion #region �ӱ���Ϣ StringBuilder strSql2 = new StringBuilder(); strSql2.Append("select id,article_id,order_id,goods_id,goods_no,goods_title,img_url,spec_text,goods_price,real_price,quantity,point"); strSql2.Append(" from " + databaseprefix + "order_goods "); strSql2.Append(" where order_id=@id "); SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int,4)}; parameters2[0].Value = model.id; DataSet ds2 = DbHelperSQL.Query(strSql2.ToString(), parameters2); if (ds2.Tables[0].Rows.Count > 0) { List<Model.order_goods> ls = new List<Model.order_goods>(); for (int n = 0; n < ds2.Tables[0].Rows.Count; n++) { Model.order_goods modelt = new Model.order_goods(); if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "") { modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString()); } if (ds2.Tables[0].Rows[n]["article_id"] != null && ds2.Tables[0].Rows[n]["article_id"].ToString() != "") { modelt.article_id = int.Parse(ds2.Tables[0].Rows[n]["article_id"].ToString()); } if (ds2.Tables[0].Rows[n]["order_id"] != null && ds2.Tables[0].Rows[n]["order_id"].ToString() != "") { modelt.order_id = int.Parse(ds2.Tables[0].Rows[n]["order_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_id"] != null && ds2.Tables[0].Rows[n]["goods_id"].ToString() != "") { modelt.goods_id = int.Parse(ds2.Tables[0].Rows[n]["goods_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_no"] != null) { modelt.goods_no = ds2.Tables[0].Rows[n]["goods_no"].ToString(); } if (ds2.Tables[0].Rows[n]["goods_title"] != null) { modelt.goods_title = ds2.Tables[0].Rows[n]["goods_title"].ToString(); } if (ds2.Tables[0].Rows[n]["img_url"] != null) { modelt.img_url = ds2.Tables[0].Rows[n]["img_url"].ToString(); } if (ds2.Tables[0].Rows[n]["spec_text"] != null) { modelt.spec_text = ds2.Tables[0].Rows[n]["spec_text"].ToString(); } if (ds2.Tables[0].Rows[n]["goods_price"] != null && ds2.Tables[0].Rows[n]["goods_price"].ToString() != "") { modelt.goods_price = decimal.Parse(ds2.Tables[0].Rows[n]["goods_price"].ToString()); } if (ds2.Tables[0].Rows[n]["real_price"] != null && ds2.Tables[0].Rows[n]["real_price"].ToString() != "") { modelt.real_price = decimal.Parse(ds2.Tables[0].Rows[n]["real_price"].ToString()); } if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "") { modelt.quantity = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString()); } if (ds2.Tables[0].Rows[n]["point"] != null && ds2.Tables[0].Rows[n]["point"].ToString() != "") { modelt.point = int.Parse(ds2.Tables[0].Rows[n]["point"].ToString()); } ls.Add(modelt); } model.order_goods = ls; } #endregion } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.orders GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,order_no,trade_no,user_id,user_name,payment_id,payment_fee,payment_status,payment_time,express_id,express_no,express_fee,express_status,express_time,accept_name,post_code,telphone,mobile,area,address,message,remark,payable_amount,real_amount,order_amount,point,status,add_time,confirm_time,complete_time"); strSql.Append(" from " + databaseprefix + "orders "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.orders model = new Model.orders(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { #region 父表信息 if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.order_no = ds.Tables[0].Rows[0]["order_no"].ToString(); model.trade_no = ds.Tables[0].Rows[0]["trade_no"].ToString(); if (ds.Tables[0].Rows[0]["user_id"].ToString() != "") { model.user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString()); } model.user_name = ds.Tables[0].Rows[0]["user_name"].ToString(); if (ds.Tables[0].Rows[0]["payment_id"].ToString() != "") { model.payment_id = int.Parse(ds.Tables[0].Rows[0]["payment_id"].ToString()); } if (ds.Tables[0].Rows[0]["payment_fee"].ToString() != "") { model.payment_fee = decimal.Parse(ds.Tables[0].Rows[0]["payment_fee"].ToString()); } if (ds.Tables[0].Rows[0]["payment_status"].ToString() != "") { model.payment_status = int.Parse(ds.Tables[0].Rows[0]["payment_status"].ToString()); } if (ds.Tables[0].Rows[0]["payment_time"].ToString() != "") { model.payment_time = DateTime.Parse(ds.Tables[0].Rows[0]["payment_time"].ToString()); } if (ds.Tables[0].Rows[0]["express_id"].ToString() != "") { model.express_id = int.Parse(ds.Tables[0].Rows[0]["express_id"].ToString()); } model.express_no = ds.Tables[0].Rows[0]["express_no"].ToString(); if (ds.Tables[0].Rows[0]["express_fee"].ToString() != "") { model.express_fee = decimal.Parse(ds.Tables[0].Rows[0]["express_fee"].ToString()); } if (ds.Tables[0].Rows[0]["express_status"].ToString() != "") { model.express_status = int.Parse(ds.Tables[0].Rows[0]["express_status"].ToString()); } if (ds.Tables[0].Rows[0]["express_time"].ToString() != "") { model.express_time = DateTime.Parse(ds.Tables[0].Rows[0]["express_time"].ToString()); } model.accept_name = ds.Tables[0].Rows[0]["accept_name"].ToString(); model.post_code = ds.Tables[0].Rows[0]["post_code"].ToString(); model.telphone = ds.Tables[0].Rows[0]["telphone"].ToString(); model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString(); model.area = ds.Tables[0].Rows[0]["area"].ToString(); model.address = ds.Tables[0].Rows[0]["address"].ToString(); model.message = ds.Tables[0].Rows[0]["message"].ToString(); model.remark = ds.Tables[0].Rows[0]["remark"].ToString(); if (ds.Tables[0].Rows[0]["payable_amount"].ToString() != "") { model.payable_amount = decimal.Parse(ds.Tables[0].Rows[0]["payable_amount"].ToString()); } if (ds.Tables[0].Rows[0]["real_amount"].ToString() != "") { model.real_amount = decimal.Parse(ds.Tables[0].Rows[0]["real_amount"].ToString()); } if (ds.Tables[0].Rows[0]["order_amount"].ToString() != "") { model.order_amount = decimal.Parse(ds.Tables[0].Rows[0]["order_amount"].ToString()); } if (ds.Tables[0].Rows[0]["point"].ToString() != "") { model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString()); } if (ds.Tables[0].Rows[0]["status"].ToString() != "") { model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString()); } if (ds.Tables[0].Rows[0]["add_time"].ToString() != "") { model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString()); } if (ds.Tables[0].Rows[0]["confirm_time"].ToString() != "") { model.confirm_time = DateTime.Parse(ds.Tables[0].Rows[0]["confirm_time"].ToString()); } if (ds.Tables[0].Rows[0]["complete_time"].ToString() != "") { model.complete_time = DateTime.Parse(ds.Tables[0].Rows[0]["complete_time"].ToString()); } #endregion #region 子表信息 StringBuilder strSql2 = new StringBuilder(); strSql2.Append("select id,order_id,goods_id,goods_title,goods_price,real_price,quantity,point from " + databaseprefix + "order_goods "); strSql2.Append(" where order_id=@id "); SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters2[0].Value = id; DataSet ds2 = DbHelperSQL.Query(strSql2.ToString(), parameters2); if (ds2.Tables[0].Rows.Count > 0) { int i = ds2.Tables[0].Rows.Count; List <Model.order_goods> models = new List <Model.order_goods>(); Model.order_goods modelt; for (int n = 0; n < i; n++) { modelt = new Model.order_goods(); if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "") { modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString()); } if (ds2.Tables[0].Rows[n]["order_id"] != null && ds2.Tables[0].Rows[n]["order_id"].ToString() != "") { modelt.order_id = int.Parse(ds2.Tables[0].Rows[n]["order_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_id"] != null && ds2.Tables[0].Rows[n]["goods_id"].ToString() != "") { modelt.goods_id = int.Parse(ds2.Tables[0].Rows[n]["goods_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_title"] != null && ds2.Tables[0].Rows[n]["goods_title"].ToString() != "") { modelt.goods_title = ds2.Tables[0].Rows[n]["goods_title"].ToString(); } if (ds2.Tables[0].Rows[n]["goods_price"] != null && ds2.Tables[0].Rows[n]["goods_price"].ToString() != "") { modelt.goods_price = decimal.Parse(ds2.Tables[0].Rows[n]["goods_price"].ToString()); } if (ds2.Tables[0].Rows[n]["real_price"] != null && ds2.Tables[0].Rows[n]["real_price"].ToString() != "") { modelt.real_price = decimal.Parse(ds2.Tables[0].Rows[n]["real_price"].ToString()); } if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "") { modelt.quantity = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString()); } if (ds2.Tables[0].Rows[n]["point"] != null && ds2.Tables[0].Rows[n]["point"].ToString() != "") { modelt.point = int.Parse(ds2.Tables[0].Rows[n]["point"].ToString()); } models.Add(modelt); } model.order_goods = models; } #endregion return(model); } else { return(null); } }
protected void btnlogin_Click(object sender, ImageClickEventArgs e) { DataTable dt = (DataTable)Session["DGCart"]; if (dt.Rows.Count <= 0) { Response.Redirect("productJPlist.aspx"); } Model.orders model = new Model.orders(); model.order_no = hideNo.Value; model.user_id = WEBUserCurrent.UserID; model.user_name = WEBUserCurrent.UserName; model.payment_id = string.IsNullOrEmpty(ddlzhifu.SelectedValue) ? 0 : int.Parse(ddlzhifu.SelectedValue); //付款類型 model.distribution_id = string.IsNullOrEmpty(ddlpeisong.SelectedValue) ? 0 : int.Parse(ddlpeisong.SelectedValue); //配送類型 model.accept_name = txtusername.Value; model.post_code = txtyoubian.Value; model.telphone = txtlianxidianhua.Value; model.mobile = txtphone.Value; model.address = txtdizhi.Value; model.message = txtliuyan.Value; model.payable_freight = decimal.Parse(Fee); //應付運費 model.real_freight = decimal.Parse(Fee); //實付運費 model.payment_fee = 0; //付款手續費 model.point = Utils.StringToNum(hidePoint.Value); //獲得的積分 model.add_time = DateTime.Now; model.order_goods = new List <order_goods>(); decimal Price = 0m; decimal GoodsPrice = 0, GoodToablPrice = 0; for (int i = 0; i < dt.Rows.Count; i++) { int ProductID = int.Parse(dt.Rows[i]["GoodsId"].ToString()); int ShopNumber = int.Parse(dt.Rows[i]["GoodsCount"].ToString()); Model.article_goods modelpro = bll.GetGoodsModel(ProductID); Price = modelpro.sell_price; GoodsPrice = ShopNumber * Price; GoodToablPrice += GoodsPrice; Model.order_goods detail = new Model.order_goods(); detail.goods_id = ProductID; detail.goods_name = dt.Rows[i]["GoodsName"].ToString(); detail.goods_price = Price; detail.point = Utils.StringToNum(hidePoint.Value); detail.quantity = ShopNumber; detail.real_price = modelpro.market_price; model.order_goods.Add(detail); } #region 算折扣 string aa = Request.Form["chkPoint"]; decimal PousePrice = 0, LastPrice = 0; if (!string.IsNullOrEmpty(aa)) { PousePrice = GoodToablPrice - decimal.Parse(hidePoint.Value); //model.payable_amount = model.order_amount; //model.real_amount = model.order_amount; } else { PousePrice = GoodToablPrice; } #endregion #region 算运费 if (hideFee.Value == "2") { decimal FeeLv = TwoTypeFee; if (PousePrice >= FeeLv) { LastPrice = PousePrice; model.payable_freight = 0; //應付運費 model.real_freight = 0; //實付運費 } else { LastPrice = PousePrice + decimal.Parse(Fee); //訂單總金額 } } else { LastPrice = PousePrice + decimal.Parse(Fee); //訂單總金額 } #endregion model.order_amount = LastPrice; //訂單總金額 model.payable_amount = LastPrice; //應付商品總金額 model.real_amount = LastPrice; //實付商品總金額 #region 清空购物车 dt.Clear(); #endregion 清空购物车 //普通訂單的情況下修改狀態 if (!string.IsNullOrEmpty(Request.QueryString["cjid"])) { int id = Convert.ToInt32(Request.QueryString["cjid"]); BLL.article bll = new BLL.article(); Model.article_goods productmodel = bll.GetGoodsModel(id); bll.UpdateField(id, "Status=3"); model.status = 6; } int bk = bllorder.Add(model); string Url = "pay.aspx?"; Url += "paymenttype=" + ddlzhifu.SelectedValue + ""; Url += "&id=" + bk + ""; // string UserUrl = "userinfo.aspx"; if (bk > 0) { //setEmail(model.order_no); UpUserPoint(PousePrice); int Uid = WEBUserCurrent.UserID; User.UpJianPoint(Uid, Utils.StringToNum(hidePoint.Value)); AddAmount(LastPrice); this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('送出訂單成功,請牢記訂單號:" + model.order_no + "');window.location.href = '" + Url + "';</script>"); // Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "pay", "window.open('" + Url + "');window.location.href='" + UserUrl + "';", true); //Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "pay", "window.open('" + Url + "');", true); //Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "transfer", "window.location.href='" + UserUrl + "';", true); } else { this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('送出失敗,請重新送出');window.location.href = '" + Url + "';</script>"); } }
public string SubmitOrder(string goods, string addressId, string expressId, string totalprice, string bill_type, string bill_rise, string down_order, string coupon_no, string store_name, string store_address, string store_id, string user_id, string remark) { string returnvalue = ""; Model.orders model = new Model.orders(); BLL.orders bll = new BLL.orders(); //验证优惠券 var j = 0; BLL.user_coupon couponbll = new BLL.user_coupon(); Model.user_coupon coupon = null; if (coupon_no != "") { coupon = couponbll.GetModel(" str_code='" + coupon_no + "'"); if (coupon == null) { j = 1; } else { if (DateTime.Compare(coupon.end_time, DateTime.Now) <= 0) { j = 2; } if (coupon.status == 2) { j = 3; } } } if (j == 1) { return(returnvalue = "{\"status\":0,\"msg\":\"优惠券编码输入有误!\"}"); } if (j == 2) { return(returnvalue = "{\"status\":0,\"msg\":\"优惠券已经过期!\"}"); } if (j == 3) { return(returnvalue = "{\"status\":0,\"msg\":\"优惠券已使用!\"}"); } BLL.users bll1 = new BLL.users(); Model.users userinfo = bll1.GetModel(int.Parse(user_id)); if (addressId != "0")//快递收货 { //订单信息 Model.user_address modelAddress = new BLL.user_address().GetModel(int.Parse(addressId)); Model.express modelExpress = new BLL.express().GetModel(int.Parse(expressId)); model.order_no = CreateOrderNo(); model.accept_name = modelAddress.acceptName; model.area = modelAddress.id.ToString(); model.mobile = modelAddress.mobile; model.address = modelAddress.address; model.post_code = modelAddress.postcode.ToString(); model.add_time = DateTime.Now; model.user_id = userinfo.id; model.user_name = userinfo.user_name; model.express_id = int.Parse(expressId); model.express_fee = modelExpress.express_fee; model.express_status = 1; model.status = 1; decimal real_amount = Decimal.Parse(totalprice) - modelExpress.express_fee; model.real_amount = real_amount; model.order_amount = Decimal.Parse(totalprice); model.bill_type = int.Parse(bill_type); if (int.Parse(bill_type) != 0) { model.is_bill = 1; } model.invoice_rise = bill_rise; model.down_order = down_order; model.remark = remark; } else { //订单信息 Model.express modelExpress = new BLL.express().GetModel(int.Parse(expressId)); model.order_no = CreateOrderNo(); model.add_time = DateTime.Now; model.user_id = userinfo.id; model.user_name = userinfo.user_name; model.express_id = int.Parse(expressId); model.express_fee = modelExpress.express_fee; model.express_status = 1; model.status = 1; decimal real_amount = Decimal.Parse(totalprice) - modelExpress.express_fee; model.real_amount = real_amount; model.order_amount = Decimal.Parse(totalprice); model.bill_type = int.Parse(bill_type); if (int.Parse(bill_type) != 0) { model.is_bill = 1; } model.invoice_rise = bill_rise; model.down_order = down_order; model.store_name = store_name; model.store_address = store_address; model.store_id = int.Parse(store_id); model.remark = remark; } var k = 0; var p = 0; if (coupon != null) { decimal payamount = Decimal.Parse(totalprice) - coupon.amount; if (payamount > 0) { model.payable_amount = payamount;//实付款 model.str_code = coupon_no; } else { model.payable_amount = 0M;//实付款 model.str_code = coupon_no; model.status = 2; model.payment_status = 2; p = bll.Add(model); k = 1; } } ////商品信息value="<%#Eval("id") %>|<%#Eval("type") %>|<%#Eval("price") %>|<%#Eval("quantity") %>|<%#Eval("weight") %>|<%#Eval("img_url") %>" List <Model.order_goods> list = new List <Model.order_goods>(); string[] strArr = Vincent._DTcms.Utils.DelLastChar(goods, "&").Split('&'); foreach (var item in strArr) { string[] strArr2 = item.Split('|'); Model.order_goods modelGoods = new Model.order_goods(); modelGoods.goods_id = int.Parse(strArr2[0].ToString()); modelGoods.goods_price = decimal.Parse(strArr2[1].ToString()); modelGoods.quantity = int.Parse(strArr2[2].ToString()); modelGoods.goods_pic = strArr2[3].ToString(); modelGoods.goods_title = strArr2[4].ToString(); list.Add(modelGoods); } model.order_goods = list; int orderId = bll.Add(model); //优惠券使用记录 BLL.user_coupon_log cbll = new BLL.user_coupon_log(); Model.user_coupon_log cmodel = new Model.user_coupon_log(); if (coupon != null) { cmodel.user_id = userinfo.id; cmodel.user_name = userinfo.user_name; cmodel.coupon_id = coupon.id; cmodel.str_code = coupon.str_code; cmodel.order_id = orderId; cmodel.order_no = model.order_no; cmodel.add_time = coupon.add_time; cmodel.use_time = DateTime.Now; cmodel.status = 1; } if (k == 1 && p > 0) { cmodel.status = 2; cbll.Add(cmodel); return(returnvalue = "{\"status\":3,\"msg\":\"订单提交成功!\"}"); } if (orderId > 0) { if (coupon != null) { cbll.Add(cmodel); } return(returnvalue = "{\"status\":1,\"msg\":\"订单提交成功,请付款!\",\"orderId\":" + orderId + "}"); Web.UI.ShopCart.ClearCart("0"); } else { if (coupon != null) { cbll.Add(cmodel); } return(returnvalue = "{\"status\":0,\"msg\":\"订单提交失败,请重新提交订单!\"}"); } }
protected void Page_Load(object sender, EventArgs e) { webUrl = "http://" + Utils.GetHomeUrl(); XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetXmlMapPath("Configpathofubao")); string merchantid1 = doc.SelectSingleNode(@"Root/merID").InnerText; string HashKey = doc.SelectSingleNode(@"Root/MerchantID").InnerText; string HashIV = doc.SelectSingleNode(@"Root/TerminalID").InnerText; id = Request["id"]; paymenttype = Request["paymenttype"]; if (!string.IsNullOrEmpty(paymenttype)) { if (paymenttype == "lian") { ptype = "Credit"; } if (paymenttype == "1") { ptype = "Credit"; } if (paymenttype == "2") { ptype = "WebATM"; } if (paymenttype == "") { ptype = "ATM"; } if (paymenttype == "3") { ptype = "CVS"; } if (paymenttype == "barcode") { ptype = "BARCODE"; } if (paymenttype == "alipay") { ptype = "Alipay"; } if (paymenttype == "") { ptype = "Tenpay"; } } else { ptype = "ALL"; } if (!string.IsNullOrEmpty(id)) { BLL.orders bll = new BLL.orders(); model = bll.GetModel(BLL.Function.Instance.StringToNum(id)); BLL.users bllUser = new BLL.users(); User = bllUser.GetModel(model.user_id); Model.order_goods Order_Info = new Model.order_goods(); Order_Info = bll.Getorder_goodsModel(model.id);; } string ok_urlall = string.Empty; ok_urlall = webUrl + "/allpay_ok.aspx"; //返回地址 StringBuilder sb = new StringBuilder(); StringBuilder sbHtml = new StringBuilder(); if (!string.IsNullOrEmpty(ptype)) { string merchantid = "1038690"; merchantid = merchantid1; string url = ""; //url sb.Append("HashKey=" + HashKey + "");//7RswcwBgLcqnMjy5 if (ptype == "Alipay") { sb.Append("&AlipayItemCounts=1"); sb.Append("&AlipayItemName=" + model.order_no + ""); sb.Append("&AlipayItemPrice=1"); } sb.Append("&ChoosePayment=" + ptype + ""); if (ptype == "Alipay") { sb.Append("&Email=" + User.email + ""); } sb.Append("&ItemName=" + model.order_no + ""); sb.Append("&MerchantID=" + merchantid + ""); string time = model.add_time.ToString("yyyy/MM/dd HH:mm:ss").Replace("-", "/"); sb.Append("&MerchantTradeDate=" + model.add_time.ToString("yyyy/MM/dd HH:mm:ss").Replace("-", "/") + ""); sb.Append("&MerchantTradeNo=" + model.order_no + ""); sb.Append("&OrderResultURL=" + ok_urlall + ""); sb.Append("&PaymentType=aio"); if (ptype == "Alipay") { sb.Append("&PhoneNo=" + model.mobile + ""); } sb.Append("&Remark=" + model.order_no + ""); sb.Append("&ReturnURL=" + ok_urlall + ""); sb.Append("&TotalAmount=" + model.order_amount + ""); sb.Append("&TradeDesc=" + model.order_no + ""); if (ptype == "Credit") { if (paymenttype == "1") { sb.Append("&UnionPay=0"); } if (paymenttype == "lian") { sb.Append("&UnionPay=1"); } } if (ptype == "Alipay") { sb.Append("&UserName="******""); } sb.Append("&HashIV=" + HashIV + "");//IA0pz3lNuyui52iZ url = sb.ToString(); url = getstr(url).ToLower(); sb.Append("&CheckMacValue=" + BLL.Function.Instance.MD5(url, 32) + ""); string CheckMacValue = BLL.Function.Instance.MD5(url, 32); //Response.Write("url:" + url); //Response.Write(","); string savePath = Server.MapPath("PAU/"); //if (!Directory.Exists(savePath)) //{ // //需要注意的是,需要对这个物理路径有足够的权限,否则会报错 // Directory.CreateDirectory(savePath); // File.CreateText(savePath); // File.WriteAllText(savePath, url); // File.WriteAllText(savePath, "==============================================="); // File.WriteAllText(savePath, CheckMacValue); //} // Response.Write(CheckMacValue); //Atm缴费http://payment-stage.allpay.com.tw/Cashier/AioCheckOut //sbHtml.Append("<form id='paysubmit' name='ecbanksubmit' action='https://payment.allpay.com.tw/Cashier/AioCheckOut' method='post'>"); sbHtml.Append("<form id='paysubmit' name='ecbanksubmit' action=' https://payment-stage.allpay.com.tw/Cashier/AioCheckOut/V2' method='post'>"); //测试URL if (ptype == "Alipay") { sbHtml.Append("<input type='hidden' name='AlipayItemCounts' value='1'/>"); sbHtml.Append("<input type='hidden' name='AlipayItemName' value='" + model.order_no + "'/>"); sbHtml.Append("<input type='hidden' name='AlipayItemPrice' value='1'/>"); } sbHtml.Append("<input type='hidden' name='ChoosePayment' value='" + ptype + "'/>"); if (ptype == "Alipay") { sbHtml.Append("<input type='hidden' name='Email' value='" + User.email + "'/>"); } sbHtml.Append("<input type='hidden' name='ItemName' value='" + model.order_no + "'/>"); sbHtml.Append("<input type='hidden' name='MerchantID' value='" + merchantid + "'/>"); sbHtml.Append("<input type='hidden' name='MerchantTradeDate' value='" + model.add_time.ToString("yyyy/MM/dd HH:mm:ss").Replace("-", "/") + "'/>"); sbHtml.Append("<input type='hidden' name='MerchantTradeNo' value='" + model.order_no + "'/>"); sbHtml.Append("<input type='hidden' name='OrderResultURL' value='" + ok_urlall + "'/>"); sbHtml.Append("<input type='hidden' name='PaymentType' value='aio'/>"); if (ptype == "Alipay") { sbHtml.Append("<input type='hidden' name='PhoneNo' value='" + model.mobile + "'/>"); } sbHtml.Append("<input type='hidden' name='Remark' value='" + model.order_no + "'/>"); sbHtml.Append("<input type='hidden' name='ReturnURL' value='" + ok_urlall + "'/>"); sbHtml.Append("<input type='hidden' name='TotalAmount' value='" + model.order_amount + "'/>"); sbHtml.Append("<input type='hidden' name='TradeDesc' value='" + model.order_no + "'/>"); if (ptype == "Credit") { if (paymenttype == "1") { sbHtml.Append("<input type='hidden' name='UnionPay' value='0'/>"); } if (paymenttype == "lian") { sbHtml.Append("<input type='hidden' name='UnionPay' value='1'/>"); } } if (ptype == "Alipay") { sbHtml.Append("<input type='hidden' name='UserName' value='" + User.user_name + "' />"); } sbHtml.Append("<input type='hidden' name='CheckMacValue' value='" + CheckMacValue + "'/>"); sbHtml.Append("<input type='submit=Submit' style='display:none;'></form>"); sbHtml.Append("<script>document.forms['paysubmit'].submit();</script>"); Response.Write(sbHtml); Response.End(); } //atm转帐 if (paymenttype == "atm") { Response.Redirect("ordershow.aspx?id=" + id); } //銀行匯款 if (paymenttype == "hui") { Response.Redirect("ordershow.aspx?id=" + id); } //宅配貨到付款 if (paymenttype == "dao") { Response.Redirect("ordershow.aspx?id=" + id); } //到店取货 if (paymenttype == "dian") { Response.Redirect("ordershow.aspx?id=" + id); } }
/// <summary> /// 沮坝珇ID莉坝珇獺 /// </summary> public Model.order_goods GetModelGoods(int id) { #region 琩高獺 StringBuilder strSql2 = new StringBuilder(); strSql2.Append("select * from " + databaseprefix + "order_goods "); strSql2.Append(" where id=@id "); SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 8) }; parameters2[0].Value = id; Model.order_goods modelt = new Model.order_goods(); DataSet ds2 = DbHelperSQL.Query(strSql2.ToString(), parameters2); if (ds2.Tables[0].Rows.Count > 0) { int i = ds2.Tables[0].Rows.Count; for (int n = 0; n < i; n++) { if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "") { modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString()); } if (ds2.Tables[0].Rows[n]["order_id"] != null && ds2.Tables[0].Rows[n]["order_id"].ToString() != "") { modelt.order_id = int.Parse(ds2.Tables[0].Rows[n]["order_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_id"] != null && ds2.Tables[0].Rows[n]["goods_id"].ToString() != "") { modelt.goods_id = int.Parse(ds2.Tables[0].Rows[n]["goods_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_title"] != null && ds2.Tables[0].Rows[n]["goods_title"].ToString() != "") { modelt.goods_title = ds2.Tables[0].Rows[n]["goods_title"].ToString(); } if (ds2.Tables[0].Rows[n]["goods_price"] != null && ds2.Tables[0].Rows[n]["goods_price"].ToString() != "") { modelt.goods_price = decimal.Parse(ds2.Tables[0].Rows[n]["goods_price"].ToString()); } if (ds2.Tables[0].Rows[n]["real_price"] != null && ds2.Tables[0].Rows[n]["real_price"].ToString() != "") { modelt.real_price = decimal.Parse(ds2.Tables[0].Rows[n]["real_price"].ToString()); } if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "") { modelt.quantity = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString()); } if (ds2.Tables[0].Rows[n]["point"] != null && ds2.Tables[0].Rows[n]["point"].ToString() != "") { modelt.point = int.Parse(ds2.Tables[0].Rows[n]["point"].ToString()); } if (ds2.Tables[0].Rows[n]["Barcode"] != null && ds2.Tables[0].Rows[n]["Barcode"].ToString() != "") { modelt.Barcode = ds2.Tables[0].Rows[n]["Barcode"].ToString(); } if (ds2.Tables[0].Rows[n]["english_name"] != null && ds2.Tables[0].Rows[n]["english_name"].ToString() != "") { modelt.english_name = ds2.Tables[0].Rows[n]["english_name"].ToString(); } } return(modelt); } #endregion else { return(null); } }
/// <summary> /// 根据定单号返回订单列表 /// </summary> /// <param name="user_id">用户ID</param> /// <returns>订单列表</returns> public List<Model.orders> GetOrderList(string order_no) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,order_no,user_id,user_name,payment_id,distribution_id,status,payment_status,distribution_status,delivery_name,delivery_no,accept_name,post_code,telphone,mobile,address,message,payable_amount,real_amount,payable_freight,real_freight,payment_fee,order_amount,point,add_time,payment_time,confirm_time,distribution_time,complete_time from dt_orders "); strSql.Append(" where order_no=@order_no and status!=5 order by add_time desc"); SqlParameter[] parameters = { new SqlParameter("@order_no", SqlDbType.NVarChar, 50) }; parameters[0].Value = order_no; List<Model.orders> list_orders = new List<Model.orders>(); Model.orders model = null; DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { model = new Model.orders(); #region 父表信息 if (ds.Tables[0].Rows[i]["id"] != null && ds.Tables[0].Rows[i]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[i]["id"].ToString()); } if (ds.Tables[0].Rows[i]["order_no"] != null && ds.Tables[0].Rows[i]["order_no"].ToString() != "") { model.order_no = ds.Tables[0].Rows[i]["order_no"].ToString(); } if (ds.Tables[0].Rows[i]["user_id"] != null && ds.Tables[0].Rows[i]["user_id"].ToString() != "") { model.user_id = int.Parse(ds.Tables[0].Rows[i]["user_id"].ToString()); } if (ds.Tables[0].Rows[i]["user_name"] != null && ds.Tables[0].Rows[i]["user_name"].ToString() != "") { model.user_name = ds.Tables[0].Rows[i]["user_name"].ToString(); } if (ds.Tables[0].Rows[i]["payment_id"] != null && ds.Tables[0].Rows[i]["payment_id"].ToString() != "") { model.payment_id = int.Parse(ds.Tables[0].Rows[i]["payment_id"].ToString()); } if (ds.Tables[0].Rows[i]["distribution_id"] != null && ds.Tables[0].Rows[i]["distribution_id"].ToString() != "") { model.distribution_id = int.Parse(ds.Tables[0].Rows[i]["distribution_id"].ToString()); } if (ds.Tables[0].Rows[i]["status"] != null && ds.Tables[0].Rows[i]["status"].ToString() != "") { model.status = int.Parse(ds.Tables[0].Rows[i]["status"].ToString()); } if (ds.Tables[0].Rows[i]["payment_status"] != null && ds.Tables[0].Rows[i]["payment_status"].ToString() != "") { model.payment_status = int.Parse(ds.Tables[0].Rows[i]["payment_status"].ToString()); } if (ds.Tables[0].Rows[i]["distribution_status"] != null && ds.Tables[0].Rows[i]["distribution_status"].ToString() != "") { model.distribution_status = int.Parse(ds.Tables[0].Rows[i]["distribution_status"].ToString()); } if (ds.Tables[0].Rows[i]["delivery_name"] != null && ds.Tables[0].Rows[i]["delivery_name"].ToString() != "") { model.delivery_name = ds.Tables[0].Rows[i]["delivery_name"].ToString(); } if (ds.Tables[0].Rows[i]["delivery_no"] != null && ds.Tables[0].Rows[i]["delivery_no"].ToString() != "") { model.delivery_no = ds.Tables[0].Rows[i]["delivery_no"].ToString(); } if (ds.Tables[0].Rows[i]["accept_name"] != null && ds.Tables[0].Rows[i]["accept_name"].ToString() != "") { model.accept_name = ds.Tables[0].Rows[i]["accept_name"].ToString(); } if (ds.Tables[0].Rows[i]["post_code"] != null && ds.Tables[0].Rows[i]["post_code"].ToString() != "") { model.post_code = ds.Tables[0].Rows[i]["post_code"].ToString(); } if (ds.Tables[0].Rows[i]["telphone"] != null && ds.Tables[0].Rows[i]["telphone"].ToString() != "") { model.telphone = ds.Tables[0].Rows[i]["telphone"].ToString(); } if (ds.Tables[0].Rows[i]["mobile"] != null && ds.Tables[0].Rows[i]["mobile"].ToString() != "") { model.mobile = ds.Tables[0].Rows[i]["mobile"].ToString(); } if (ds.Tables[0].Rows[i]["address"] != null && ds.Tables[0].Rows[i]["address"].ToString() != "") { model.address = ds.Tables[0].Rows[i]["address"].ToString(); } if (ds.Tables[0].Rows[i]["message"] != null && ds.Tables[0].Rows[i]["message"].ToString() != "") { model.message = ds.Tables[0].Rows[i]["message"].ToString(); } if (ds.Tables[0].Rows[i]["payable_amount"] != null && ds.Tables[0].Rows[i]["payable_amount"].ToString() != "") { model.payable_amount = decimal.Parse(ds.Tables[0].Rows[i]["payable_amount"].ToString()); } if (ds.Tables[0].Rows[i]["real_amount"] != null && ds.Tables[0].Rows[i]["real_amount"].ToString() != "") { model.real_amount = decimal.Parse(ds.Tables[0].Rows[i]["real_amount"].ToString()); } if (ds.Tables[0].Rows[i]["payable_freight"] != null && ds.Tables[0].Rows[i]["payable_freight"].ToString() != "") { model.payable_freight = decimal.Parse(ds.Tables[0].Rows[i]["payable_freight"].ToString()); } if (ds.Tables[0].Rows[i]["real_freight"] != null && ds.Tables[0].Rows[i]["real_freight"].ToString() != "") { model.real_freight = decimal.Parse(ds.Tables[0].Rows[i]["real_freight"].ToString()); } if (ds.Tables[0].Rows[i]["payment_fee"] != null && ds.Tables[0].Rows[i]["payment_fee"].ToString() != "") { model.payment_fee = decimal.Parse(ds.Tables[0].Rows[i]["payment_fee"].ToString()); } if (ds.Tables[0].Rows[i]["order_amount"] != null && ds.Tables[0].Rows[i]["order_amount"].ToString() != "") { model.order_amount = decimal.Parse(ds.Tables[0].Rows[i]["order_amount"].ToString()); } if (ds.Tables[0].Rows[i]["point"] != null && ds.Tables[0].Rows[i]["point"].ToString() != "") { model.point = int.Parse(ds.Tables[0].Rows[i]["point"].ToString()); } if (ds.Tables[0].Rows[i]["add_time"] != null && ds.Tables[0].Rows[i]["add_time"].ToString() != "") { model.add_time = DateTime.Parse(ds.Tables[0].Rows[i]["add_time"].ToString()); } if (ds.Tables[0].Rows[i]["payment_time"] != null && ds.Tables[0].Rows[i]["payment_time"].ToString() != "") { model.payment_time = DateTime.Parse(ds.Tables[0].Rows[i]["payment_time"].ToString()); } if (ds.Tables[0].Rows[i]["confirm_time"] != null && ds.Tables[0].Rows[i]["confirm_time"].ToString() != "") { model.confirm_time = DateTime.Parse(ds.Tables[0].Rows[i]["confirm_time"].ToString()); } if (ds.Tables[0].Rows[i]["distribution_time"] != null && ds.Tables[0].Rows[i]["distribution_time"].ToString() != "") { model.distribution_time = DateTime.Parse(ds.Tables[0].Rows[i]["distribution_time"].ToString()); } if (ds.Tables[0].Rows[i]["complete_time"] != null && ds.Tables[0].Rows[i]["complete_time"].ToString() != "") { model.complete_time = DateTime.Parse(ds.Tables[0].Rows[i]["complete_time"].ToString()); } #endregion #region 子表信息 StringBuilder strSql2 = new StringBuilder(); strSql2.Append("select id,order_id,goods_id,goods_name,goods_price,real_price,quantity,point,status,unique_code,menpiao_type from dt_order_goods "); strSql2.Append(" where order_id=@id "); SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters2[0].Value = model.id; DataSet ds2 = DbHelperSQL.Query(strSql2.ToString(), parameters2); if (ds2.Tables[0].Rows.Count > 0) { #region 子表字段信息 int y = ds2.Tables[0].Rows.Count; List<Model.order_goods> models = new List<Model.order_goods>(); Model.order_goods modelt; for (int n = 0; n < y; n++) { modelt = new Model.order_goods(); if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "") { modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString()); } if (ds2.Tables[0].Rows[n]["order_id"] != null && ds2.Tables[0].Rows[n]["order_id"].ToString() != "") { modelt.order_id = int.Parse(ds2.Tables[0].Rows[n]["order_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_id"] != null && ds2.Tables[0].Rows[n]["goods_id"].ToString() != "") { modelt.goods_id = int.Parse(ds2.Tables[0].Rows[n]["goods_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_name"] != null && ds2.Tables[0].Rows[n]["goods_name"].ToString() != "") { modelt.goods_name = ds2.Tables[0].Rows[n]["goods_name"].ToString(); } if (ds2.Tables[0].Rows[n]["goods_price"] != null && ds2.Tables[0].Rows[n]["goods_price"].ToString() != "") { modelt.goods_price = decimal.Parse(ds2.Tables[0].Rows[n]["goods_price"].ToString()); } if (ds2.Tables[0].Rows[n]["real_price"] != null && ds2.Tables[0].Rows[n]["real_price"].ToString() != "") { modelt.real_price = decimal.Parse(ds2.Tables[0].Rows[n]["real_price"].ToString()); } if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "") { modelt.quantity = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString()); } if (ds2.Tables[0].Rows[n]["menpiao_type"] != null && ds2.Tables[0].Rows[n]["menpiao_type"].ToString() != "") { modelt.menpiao_type = int.Parse(ds2.Tables[0].Rows[n]["menpiao_type"].ToString()); } if (ds2.Tables[0].Rows[n]["point"] != null && ds2.Tables[0].Rows[n]["point"].ToString() != "") { modelt.point = int.Parse(ds2.Tables[0].Rows[n]["point"].ToString()); } if (ds2.Tables[0].Rows[n]["status"] != null && ds2.Tables[0].Rows[n]["status"].ToString() != "") { modelt.status = int.Parse(ds2.Tables[0].Rows[n]["status"].ToString()); } if (ds2.Tables[0].Rows[n]["unique_code"] != null && ds2.Tables[0].Rows[n]["unique_code"].ToString() != "") { modelt.unique_code = ds2.Tables[0].Rows[n]["unique_code"].ToString(); } models.Add(modelt); } model.order_goods = models; #endregion } #endregion list_orders.Add(model); } if (list_orders.Count == 0) { return null; } return list_orders; ; }
/// <summary> /// �õ�һ������ʵ�� /// </summary> public Model.orders GetModel(int id,int wid) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,order_no,trade_no,user_id,user_name,payment_id,payment_fee,payment_status,payment_time,express_id,express_no,express_fee,express_status,express_time,accept_name,post_code,telphone,mobile,area,address,message,remark,payable_amount,real_amount,order_amount,point,status,add_time,confirm_time,complete_time,wid,openid,modelName,modelCode,modelActionName,modelActionId,orderSubject,city,district,notify_id,pay_info,isSubscribe,fahuoCode,fahuoMsg "); strSql.Append(" from " + databaseprefix + "orders "); strSql.Append(" where id=@id and wid=@wid"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4), new SqlParameter("@wid", SqlDbType.Int,4)}; parameters[0].Value = id; parameters[1].Value = wid; Model.orders model = new Model.orders(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { #region ������Ϣ if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.order_no = ds.Tables[0].Rows[0]["order_no"].ToString(); model.trade_no = ds.Tables[0].Rows[0]["trade_no"].ToString(); if (ds.Tables[0].Rows[0]["user_id"].ToString() != "") { model.user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString()); } model.user_name = ds.Tables[0].Rows[0]["user_name"].ToString(); if (ds.Tables[0].Rows[0]["payment_id"].ToString() != "") { model.payment_id = int.Parse(ds.Tables[0].Rows[0]["payment_id"].ToString()); } if (ds.Tables[0].Rows[0]["payment_fee"].ToString() != "") { model.payment_fee = decimal.Parse(ds.Tables[0].Rows[0]["payment_fee"].ToString()); } if (ds.Tables[0].Rows[0]["payment_status"].ToString() != "") { model.payment_status = int.Parse(ds.Tables[0].Rows[0]["payment_status"].ToString()); } if (ds.Tables[0].Rows[0]["payment_time"].ToString() != "") { model.payment_time = DateTime.Parse(ds.Tables[0].Rows[0]["payment_time"].ToString()); } if (ds.Tables[0].Rows[0]["express_id"].ToString() != "") { model.express_id = int.Parse(ds.Tables[0].Rows[0]["express_id"].ToString()); } model.express_no = ds.Tables[0].Rows[0]["express_no"].ToString(); if (ds.Tables[0].Rows[0]["express_fee"].ToString() != "") { model.express_fee = decimal.Parse(ds.Tables[0].Rows[0]["express_fee"].ToString()); } if (ds.Tables[0].Rows[0]["express_status"].ToString() != "") { model.express_status = int.Parse(ds.Tables[0].Rows[0]["express_status"].ToString()); } if (ds.Tables[0].Rows[0]["express_time"].ToString() != "") { model.express_time = DateTime.Parse(ds.Tables[0].Rows[0]["express_time"].ToString()); } model.accept_name = ds.Tables[0].Rows[0]["accept_name"].ToString(); model.post_code = ds.Tables[0].Rows[0]["post_code"].ToString(); model.telphone = ds.Tables[0].Rows[0]["telphone"].ToString(); model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString(); model.area = ds.Tables[0].Rows[0]["area"].ToString(); model.address = ds.Tables[0].Rows[0]["address"].ToString(); model.message = ds.Tables[0].Rows[0]["message"].ToString(); model.remark = ds.Tables[0].Rows[0]["remark"].ToString(); if (ds.Tables[0].Rows[0]["payable_amount"].ToString() != "") { model.payable_amount = decimal.Parse(ds.Tables[0].Rows[0]["payable_amount"].ToString()); } if (ds.Tables[0].Rows[0]["real_amount"].ToString() != "") { model.real_amount = decimal.Parse(ds.Tables[0].Rows[0]["real_amount"].ToString()); } if (ds.Tables[0].Rows[0]["order_amount"].ToString() != "") { model.order_amount = decimal.Parse(ds.Tables[0].Rows[0]["order_amount"].ToString()); } if (ds.Tables[0].Rows[0]["point"].ToString() != "") { model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString()); } if (ds.Tables[0].Rows[0]["status"].ToString() != "") { model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString()); } if (ds.Tables[0].Rows[0]["add_time"].ToString() != "") { model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString()); } if (ds.Tables[0].Rows[0]["confirm_time"].ToString() != "") { model.confirm_time = DateTime.Parse(ds.Tables[0].Rows[0]["confirm_time"].ToString()); } if (ds.Tables[0].Rows[0]["complete_time"].ToString() != "") { model.complete_time = DateTime.Parse(ds.Tables[0].Rows[0]["complete_time"].ToString()); } if (ds.Tables[0].Rows[0]["wid"] != null && ds.Tables[0].Rows[0]["wid"].ToString() != "") { model.wid = int.Parse(ds.Tables[0].Rows[0]["wid"].ToString()); } if (ds.Tables[0].Rows[0]["openid"] != null) { model.openid = ds.Tables[0].Rows[0]["openid"].ToString(); } if (ds.Tables[0].Rows[0]["modelName"] != null) { model.modelName = ds.Tables[0].Rows[0]["modelName"].ToString(); } if (ds.Tables[0].Rows[0]["modelCode"] != null) { model.modelCode = ds.Tables[0].Rows[0]["modelCode"].ToString(); } if (ds.Tables[0].Rows[0]["modelActionName"] != null) { model.modelActionName = ds.Tables[0].Rows[0]["modelActionName"].ToString(); } if (ds.Tables[0].Rows[0]["modelActionId"] != null && ds.Tables[0].Rows[0]["modelActionId"].ToString() != "") { model.modelActionId = int.Parse(ds.Tables[0].Rows[0]["modelActionId"].ToString()); } if (ds.Tables[0].Rows[0]["orderSubject"] != null) { model.orderSubject = ds.Tables[0].Rows[0]["orderSubject"].ToString(); } if (ds.Tables[0].Rows[0]["city"] != null) { model.city = ds.Tables[0].Rows[0]["city"].ToString(); } if (ds.Tables[0].Rows[0]["district"] != null) { model.district = ds.Tables[0].Rows[0]["district"].ToString(); } if (ds.Tables[0].Rows[0]["notify_id"] != null) { model.notify_id = ds.Tables[0].Rows[0]["notify_id"].ToString(); } if (ds.Tables[0].Rows[0]["pay_info"] != null) { model.pay_info = ds.Tables[0].Rows[0]["pay_info"].ToString(); } if (ds.Tables[0].Rows[0]["isSubscribe"] != null && ds.Tables[0].Rows[0]["isSubscribe"].ToString() != "") { if ((ds.Tables[0].Rows[0]["isSubscribe"].ToString() == "1") || (ds.Tables[0].Rows[0]["isSubscribe"].ToString().ToLower() == "true")) { model.isSubscribe = true; } else { model.isSubscribe = false; } } if (ds.Tables[0].Rows[0]["fahuoCode"] != null) { model.fahuoCode = ds.Tables[0].Rows[0]["fahuoCode"].ToString(); } if (ds.Tables[0].Rows[0]["fahuoMsg"] != null) { model.fahuoMsg = ds.Tables[0].Rows[0]["fahuoMsg"].ToString(); } #endregion #region �ӱ���Ϣ StringBuilder strSql2 = new StringBuilder(); strSql2.Append("select id,order_id,goods_id,goods_title,goods_price,real_price,quantity,point from " + databaseprefix + "order_goods "); strSql2.Append(" where order_id=@id "); SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int,4)}; parameters2[0].Value = id; DataSet ds2 = DbHelperSQL.Query(strSql2.ToString(), parameters2); if (ds2.Tables[0].Rows.Count > 0) { int i = ds2.Tables[0].Rows.Count; List<Model.order_goods> models = new List<Model.order_goods>(); Model.order_goods modelt; for (int n = 0; n < i; n++) { modelt = new Model.order_goods(); if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "") { modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString()); } if (ds2.Tables[0].Rows[n]["order_id"] != null && ds2.Tables[0].Rows[n]["order_id"].ToString() != "") { modelt.order_id = int.Parse(ds2.Tables[0].Rows[n]["order_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_id"] != null && ds2.Tables[0].Rows[n]["goods_id"].ToString() != "") { modelt.goods_id = int.Parse(ds2.Tables[0].Rows[n]["goods_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_title"] != null && ds2.Tables[0].Rows[n]["goods_title"].ToString() != "") { modelt.goods_title = ds2.Tables[0].Rows[n]["goods_title"].ToString(); } if (ds2.Tables[0].Rows[n]["goods_price"] != null && ds2.Tables[0].Rows[n]["goods_price"].ToString() != "") { modelt.goods_price = decimal.Parse(ds2.Tables[0].Rows[n]["goods_price"].ToString()); } if (ds2.Tables[0].Rows[n]["real_price"] != null && ds2.Tables[0].Rows[n]["real_price"].ToString() != "") { modelt.real_price = decimal.Parse(ds2.Tables[0].Rows[n]["real_price"].ToString()); } if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "") { modelt.quantity = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString()); } if (ds2.Tables[0].Rows[n]["point"] != null && ds2.Tables[0].Rows[n]["point"].ToString() != "") { modelt.point = int.Parse(ds2.Tables[0].Rows[n]["point"].ToString()); } models.Add(modelt); } model.order_goods = models; } #endregion return model; } else { return null; } }
protected void Page_Load(object sender, EventArgs e) { id = Request["id"]; paymenttype = Request["paymenttype"]; if (!string.IsNullOrEmpty(paymenttype)) { if (paymenttype == "lian") { ptype = "Credit"; } if (paymenttype == "1") { ptype = "Credit"; } if (paymenttype == "2") { ptype = "WebATM"; } if (paymenttype == "") { ptype = "ATM"; } if (paymenttype == "3") { ptype = "CVS"; } if (paymenttype == "barcode") { ptype = "BARCODE"; } if (paymenttype == "alipay") { ptype = "Alipay"; } if (paymenttype == "") { ptype = "Tenpay"; } } else { ptype = "ALL"; } if (!string.IsNullOrEmpty(id)) { BLL.orders bll = new BLL.orders(); model = bll.GetModel(BLL.Function.Instance.StringToNum(id)); BLL.users bllUser = new BLL.users(); User = bllUser.GetModel(model.user_id); Model.order_goods Order_Info = new Model.order_goods(); Order_Info = bll.Getorder_goodsModel(model.id);; } string ok_urlall = string.Empty; ok_urlall = "http://diguang.myflysoft.com/allpay_ok.aspx"; //返回地址 StringBuilder sb = new StringBuilder(); StringBuilder sbHtml = new StringBuilder(); if (!string.IsNullOrEmpty(ptype)) { string merchantid = "2000132"; string url = ""; //url sb.Append("HashKey=5294y06JbISpM5x9"); if (ptype == "Alipay") { sb.Append("&AlipayItemCounts=1"); sb.Append("&AlipayItemName=" + model.order_no + ""); sb.Append("&AlipayItemPrice=1"); } sb.Append("&ChoosePayment=" + ptype + ""); if (ptype == "Alipay") { sb.Append("&Email=" + User.email + ""); } sb.Append("&ItemName=" + model.order_no + ""); sb.Append("&MerchantID=" + merchantid + ""); string time = model.add_time.ToString("yyyy/MM/dd HH:mm:ss").Replace("-", "/"); sb.Append("&MerchantTradeDate=" + model.add_time.ToString("yyyy/MM/dd HH:mm:ss").Replace("-", "/") + ""); sb.Append("&MerchantTradeNo=" + model.order_no + ""); sb.Append("&OrderResultURL=" + ok_urlall + ""); sb.Append("&PaymentType=aio"); if (ptype == "Alipay") { sb.Append("&PhoneNo=" + model.mobile + ""); } sb.Append("&Remark=" + model.order_no + ""); sb.Append("&ReturnURL=" + ok_urlall + ""); sb.Append("&TotalAmount=" + model.order_amount + ""); sb.Append("&TradeDesc=" + model.order_no + ""); if (ptype == "Credit") { if (paymenttype == "1") { sb.Append("&UnionPay=0"); } if (paymenttype == "lian") { sb.Append("&UnionPay=1"); } } if (ptype == "Alipay") { sb.Append("&UserName="******""); } sb.Append("&HashIV=v77hoKGq4kWxNNIS"); url = sb.ToString(); url = getstr(url).ToLower(); sb.Append("&CheckMacValue=" + BLL.Function.Instance.MD5(url, 32) + ""); string CheckMacValue = BLL.Function.Instance.MD5(url, 32); Response.Write("url:" + url); Response.Write(","); Response.Write(CheckMacValue); //Atm缴费http://payment-stage.allpay.com.tw/Cashier/AioCheckOut //atm转帐 if (paymenttype == "atm") { Response.Redirect("ordershow.aspx?id=" + id); } //銀行匯款 if (paymenttype == "hui") { Response.Redirect("ordershow.aspx?id=" + id); } //宅配貨到付款 if (paymenttype == "dao") { Response.Redirect("ordershow.aspx?id=" + id); } //到店取货 if (paymenttype == "dian") { Response.Redirect("ordershow.aspx?id=" + id); } } }
/// <summary> /// �õ�һ������ʵ�� /// </summary> public Model.orders GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,order_no,trade_no,user_id,user_name,payment_id,payment_fee,payment_status,payment_time,express_id,express_no,express_fee,express_status,express_time,accept_name,post_code,telphone,mobile,area,address,message,remark,payable_amount,real_amount,order_amount,point,status,add_time,confirm_time,complete_time,is_up,up_status"); strSql.Append(" from " + databaseprefix + "orders "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4)}; parameters[0].Value = id; Model.orders model = new Model.orders(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { #region ������Ϣ if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.order_no = ds.Tables[0].Rows[0]["order_no"].ToString(); model.trade_no = ds.Tables[0].Rows[0]["trade_no"].ToString(); if (ds.Tables[0].Rows[0]["user_id"].ToString() != "") { model.user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString()); } model.user_name = ds.Tables[0].Rows[0]["user_name"].ToString(); if (ds.Tables[0].Rows[0]["payment_id"].ToString() != "") { model.payment_id = int.Parse(ds.Tables[0].Rows[0]["payment_id"].ToString()); } if (ds.Tables[0].Rows[0]["payment_fee"].ToString() != "") { model.payment_fee = decimal.Parse(ds.Tables[0].Rows[0]["payment_fee"].ToString()); } if (ds.Tables[0].Rows[0]["payment_status"].ToString() != "") { model.payment_status = int.Parse(ds.Tables[0].Rows[0]["payment_status"].ToString()); } if (ds.Tables[0].Rows[0]["payment_time"].ToString() != "") { model.payment_time = DateTime.Parse(ds.Tables[0].Rows[0]["payment_time"].ToString()); } if (ds.Tables[0].Rows[0]["express_id"].ToString() != "") { model.express_id = int.Parse(ds.Tables[0].Rows[0]["express_id"].ToString()); } model.express_no = ds.Tables[0].Rows[0]["express_no"].ToString(); if (ds.Tables[0].Rows[0]["express_fee"].ToString() != "") { model.express_fee = decimal.Parse(ds.Tables[0].Rows[0]["express_fee"].ToString()); } if (ds.Tables[0].Rows[0]["express_status"].ToString() != "") { model.express_status = int.Parse(ds.Tables[0].Rows[0]["express_status"].ToString()); } if (ds.Tables[0].Rows[0]["express_time"].ToString() != "") { model.express_time = DateTime.Parse(ds.Tables[0].Rows[0]["express_time"].ToString()); } model.accept_name = ds.Tables[0].Rows[0]["accept_name"].ToString(); model.post_code = ds.Tables[0].Rows[0]["post_code"].ToString(); model.telphone = ds.Tables[0].Rows[0]["telphone"].ToString(); model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString(); model.area = ds.Tables[0].Rows[0]["area"].ToString(); model.address = ds.Tables[0].Rows[0]["address"].ToString(); model.message = ds.Tables[0].Rows[0]["message"].ToString(); model.remark = ds.Tables[0].Rows[0]["remark"].ToString(); if (ds.Tables[0].Rows[0]["payable_amount"].ToString() != "") { model.payable_amount = decimal.Parse(ds.Tables[0].Rows[0]["payable_amount"].ToString()); } if (ds.Tables[0].Rows[0]["real_amount"].ToString() != "") { model.real_amount = decimal.Parse(ds.Tables[0].Rows[0]["real_amount"].ToString()); } if (ds.Tables[0].Rows[0]["order_amount"].ToString() != "") { model.order_amount = decimal.Parse(ds.Tables[0].Rows[0]["order_amount"].ToString()); } if (ds.Tables[0].Rows[0]["point"].ToString() != "") { model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString()); } if (ds.Tables[0].Rows[0]["status"].ToString() != "") { model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString()); } if (ds.Tables[0].Rows[0]["add_time"].ToString() != "") { model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString()); } if (ds.Tables[0].Rows[0]["confirm_time"].ToString() != "") { model.confirm_time = DateTime.Parse(ds.Tables[0].Rows[0]["confirm_time"].ToString()); } if (ds.Tables[0].Rows[0]["complete_time"].ToString() != "") { model.complete_time = DateTime.Parse(ds.Tables[0].Rows[0]["complete_time"].ToString()); } if (ds.Tables[0].Rows[0]["is_up"].ToString() != "") { model.is_up = int.Parse(ds.Tables[0].Rows[0]["is_up"].ToString()); } if (ds.Tables[0].Rows[0]["up_status"].ToString() != "") { model.up_status = int.Parse(ds.Tables[0].Rows[0]["up_status"].ToString()); } #endregion #region �ӱ���Ϣ StringBuilder strSql2 = new StringBuilder(); strSql2.Append("select id,order_id,goods_id,goods_title,goods_price,real_price,quantity,point,standard,unit,unit_id,good_no from " + databaseprefix + "order_goods "); strSql2.Append(" where order_id=@id "); SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int,4)}; parameters2[0].Value = id; DataSet ds2 = DbHelperSQL.Query(strSql2.ToString(), parameters2); if (ds2.Tables[0].Rows.Count > 0) { int i = ds2.Tables[0].Rows.Count; List<Model.order_goods> models = new List<Model.order_goods>(); Model.order_goods modelt; for (int n = 0; n < i; n++) { modelt = new Model.order_goods(); if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "") { modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString()); } if (ds2.Tables[0].Rows[n]["order_id"] != null && ds2.Tables[0].Rows[n]["order_id"].ToString() != "") { modelt.order_id = int.Parse(ds2.Tables[0].Rows[n]["order_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_id"] != null && ds2.Tables[0].Rows[n]["goods_id"].ToString() != "") { modelt.goods_id = int.Parse(ds2.Tables[0].Rows[n]["goods_id"].ToString()); } if (ds2.Tables[0].Rows[n]["goods_title"] != null && ds2.Tables[0].Rows[n]["goods_title"].ToString() != "") { modelt.goods_title = ds2.Tables[0].Rows[n]["goods_title"].ToString(); } if (ds2.Tables[0].Rows[n]["goods_price"] != null && ds2.Tables[0].Rows[n]["goods_price"].ToString() != "") { modelt.goods_price = decimal.Parse(ds2.Tables[0].Rows[n]["goods_price"].ToString()); } if (ds2.Tables[0].Rows[n]["real_price"] != null && ds2.Tables[0].Rows[n]["real_price"].ToString() != "") { modelt.real_price = decimal.Parse(ds2.Tables[0].Rows[n]["real_price"].ToString()); } if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "") { modelt.quantity = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString()); } if (ds2.Tables[0].Rows[n]["point"] != null && ds2.Tables[0].Rows[n]["point"].ToString() != "") { modelt.point = int.Parse(ds2.Tables[0].Rows[n]["point"].ToString()); } if (ds2.Tables[0].Rows[n]["unit"] != null && ds2.Tables[0].Rows[n]["unit"].ToString() != "") { modelt.unit = ds2.Tables[0].Rows[n]["unit"].ToString(); } if (ds2.Tables[0].Rows[n]["unit_id"] != null && ds2.Tables[0].Rows[n]["unit_id"].ToString() != "") { modelt.unit_id = decimal.Parse(ds2.Tables[0].Rows[n]["unit_id"].ToString()); } modelt.standard = ds2.Tables[0].Rows[n]["standard"].ToString(); modelt.good_no = ds2.Tables[0].Rows[n]["good_no"].ToString(); models.Add(modelt); } model.order_goods = models; } #endregion return model; } else { return null; } }