private bool DoEdit(int _id) { bool flag = false; Rain.BLL.payment payment = new Rain.BLL.payment(); Rain.Model.payment model = payment.GetModel(_id); model.title = this.txtTitle.Text.Trim(); model.is_lock = !this.cbIsLock.Checked ? 1 : 0; model.sort_id = int.Parse(this.txtSortId.Text.Trim()); model.poundage_type = int.Parse(this.rblPoundageType.SelectedValue); model.poundage_amount = Decimal.Parse(this.txtPoundageAmount.Text.Trim()); model.img_url = this.txtImgUrl.Text.Trim(); model.remark = this.txtRemark.Text; if (model.api_path.ToLower() == "alipaypc") { string mapPath = Utils.GetMapPath(this.siteConfig.webpath + "xmlconfig/alipaypc.config"); XmlHelper.UpdateNodeInnerText(mapPath, "Root/partner", this.txtAlipayPartner.Text); XmlHelper.UpdateNodeInnerText(mapPath, "Root/key", this.txtAlipayKey.Text); XmlHelper.UpdateNodeInnerText(mapPath, "Root/email", this.txtAlipaySellerEmail.Text); XmlHelper.UpdateNodeInnerText(mapPath, "Root/type", this.rblAlipayType.SelectedValue); } else if (model.api_path.ToLower() == "tenpaypc") { string mapPath = Utils.GetMapPath(this.siteConfig.webpath + "xmlconfig/tenpaypc.config"); XmlHelper.UpdateNodeInnerText(mapPath, "Root/partner", this.txtTenpayBargainorId.Text); XmlHelper.UpdateNodeInnerText(mapPath, "Root/key", this.txtTenpayKey.Text); XmlHelper.UpdateNodeInnerText(mapPath, "Root/type", this.rblTenpayType.SelectedValue); } if (payment.Update(model)) { this.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改支付方式:" + model.title); flag = true; } return(flag); }
private void ShowInfo(int _id) { this.model = new Rain.BLL.payment().GetModel(_id); this.txtTitle.Text = this.model.title; this.rblType.SelectedValue = this.model.type.ToString(); this.rblType.Enabled = false; this.cbIsLock.Checked = this.model.is_lock == 0; this.txtSortId.Text = this.model.sort_id.ToString(); this.rblPoundageType.SelectedValue = this.model.poundage_type.ToString(); this.txtPoundageAmount.Text = this.model.poundage_amount.ToString(); this.txtImgUrl.Text = this.model.img_url; this.txtRemark.Text = this.model.remark; if (this.model.api_path.ToLower() == "alipaypc") { XmlDocument xmlDocument = XmlHelper.LoadXmlDoc(Utils.GetMapPath(this.siteConfig.webpath + "xmlconfig/alipaypc.config")); this.txtAlipayPartner.Text = xmlDocument.SelectSingleNode("Root/partner").InnerText; this.txtAlipayKey.Text = xmlDocument.SelectSingleNode("Root/key").InnerText; this.txtAlipaySellerEmail.Text = xmlDocument.SelectSingleNode("Root/email").InnerText; this.rblAlipayType.SelectedValue = xmlDocument.SelectSingleNode("Root/type").InnerText; } else { if (!(this.model.api_path.ToLower() == "tenpaypc")) { return; } XmlDocument xmlDocument = XmlHelper.LoadXmlDoc(Utils.GetMapPath(this.siteConfig.webpath + "xmlconfig/tenpaypc.config")); this.txtTenpayBargainorId.Text = xmlDocument.SelectSingleNode("Root/partner").InnerText; this.txtTenpayKey.Text = xmlDocument.SelectSingleNode("Root/key").InnerText; this.rblTenpayType.SelectedValue = xmlDocument.SelectSingleNode("Root/type").InnerText; } }
protected override void InitPage() { this.id = DTRequest.GetQueryInt("id"); Rain.BLL.orders orders = new Rain.BLL.orders(); if (!orders.Exists(this.id)) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")))); } else { this.model = orders.GetModel(this.id); if (this.model.user_id != this.userModel.id) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")))); } else { this.payModel = new Rain.BLL.payment().GetModel(this.model.payment_id); if (this.payModel == null) { this.payModel = new Rain.Model.payment(); } if (this.model.status <= 1 || this.model.status >= 4 || this.model.express_status != 2 || this.model.express_no.Trim().Length <= 0) { return; } new Rain.BLL.express().GetModel(this.model.express_id); new Rain.BLL.orderconfig().loadConfig(); } } }
public int Add(Rain.Model.payment model) { int maxId; using (OleDbConnection oleDbConnection = new OleDbConnection(DbHelperOleDb.connectionString)) { oleDbConnection.Open(); using (OleDbTransaction trans = oleDbConnection.BeginTransaction()) { try { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("insert into " + this.databaseprefix + "payment("); stringBuilder.Append("title,img_url,[remark],type,poundage_type,poundage_amount,sort_id,is_lock,api_path)"); stringBuilder.Append(" values ("); stringBuilder.Append("@title,@img_url,@remark,@type,@poundage_type,@poundage_amount,@sort_id,@is_lock,@api_path)"); OleDbParameter[] oleDbParameterArray = new OleDbParameter[9] { new OleDbParameter("@title", OleDbType.VarChar, 100), new OleDbParameter("@img_url", OleDbType.VarChar, (int)byte.MaxValue), new OleDbParameter("@remark", OleDbType.VarChar, 500), new OleDbParameter("@type", OleDbType.Integer, 4), new OleDbParameter("@poundage_type", OleDbType.Integer, 4), new OleDbParameter("@poundage_amount", OleDbType.Decimal, 5), new OleDbParameter("@sort_id", OleDbType.Integer, 4), new OleDbParameter("@is_lock", OleDbType.Integer, 4), new OleDbParameter("@api_path", OleDbType.VarChar, 100) }; oleDbParameterArray[0].Value = (object)model.title; oleDbParameterArray[1].Value = (object)model.img_url; oleDbParameterArray[2].Value = (object)model.remark; oleDbParameterArray[3].Value = (object)model.type; oleDbParameterArray[4].Value = (object)model.poundage_type; oleDbParameterArray[5].Value = (object)model.poundage_amount; oleDbParameterArray[6].Value = (object)model.sort_id; oleDbParameterArray[7].Value = (object)model.is_lock; oleDbParameterArray[8].Value = (object)model.api_path; DbHelperOleDb.ExecuteSql(oleDbConnection, trans, stringBuilder.ToString(), oleDbParameterArray); maxId = this.GetMaxId(oleDbConnection, trans); trans.Commit(); } catch { trans.Rollback(); return(-1); } } } return(maxId); }
public Rain.Model.payment DataRowToModel(DataRow row) { Rain.Model.payment payment = new Rain.Model.payment(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { payment.id = int.Parse(row["id"].ToString()); } if (row["title"] != null) { payment.title = row["title"].ToString(); } if (row["img_url"] != null) { payment.img_url = row["img_url"].ToString(); } if (row["remark"] != null) { payment.remark = row["remark"].ToString(); } if (row["type"] != null && row["type"].ToString() != "") { payment.type = int.Parse(row["type"].ToString()); } if (row["poundage_type"] != null && row["poundage_type"].ToString() != "") { payment.poundage_type = int.Parse(row["poundage_type"].ToString()); } if (row["poundage_amount"] != null && row["poundage_amount"].ToString() != "") { payment.poundage_amount = Decimal.Parse(row["poundage_amount"].ToString()); } if (row["sort_id"] != null && row["sort_id"].ToString() != "") { payment.sort_id = int.Parse(row["sort_id"].ToString()); } if (row["is_lock"] != null && row["is_lock"].ToString() != "") { payment.is_lock = int.Parse(row["is_lock"].ToString()); } if (row["api_path"] != null) { payment.api_path = row["api_path"].ToString(); } } return(payment); }
public Rain.Model.payment GetModel(int id) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("select top 1 id,title,img_url,[remark],type,poundage_type,poundage_amount,sort_id,is_lock,api_path"); stringBuilder.Append(" from " + this.databaseprefix + nameof(Rain.Model.payment)); stringBuilder.Append(" where id=@id"); OleDbParameter[] oleDbParameterArray = new OleDbParameter[1] { new OleDbParameter("@id", OleDbType.Integer, 4) }; oleDbParameterArray[0].Value = (object)id; Rain.Model.payment payment = new Rain.Model.payment(); DataSet dataSet = DbHelperOleDb.Query(stringBuilder.ToString(), oleDbParameterArray); if (dataSet.Tables[0].Rows.Count > 0) { return(this.DataRowToModel(dataSet.Tables[0].Rows[0])); } return((Rain.Model.payment)null); }
public bool Update(Rain.Model.payment model) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("update " + this.databaseprefix + "payment set "); stringBuilder.Append("title=@title,"); stringBuilder.Append("img_url=@img_url,"); stringBuilder.Append("[remark]=@remark,"); stringBuilder.Append("type=@type,"); stringBuilder.Append("poundage_type=@poundage_type,"); stringBuilder.Append("poundage_amount=@poundage_amount,"); stringBuilder.Append("sort_id=@sort_id,"); stringBuilder.Append("is_lock=@is_lock,"); stringBuilder.Append("api_path=@api_path"); stringBuilder.Append(" where id=@id"); OleDbParameter[] oleDbParameterArray = new OleDbParameter[10] { new OleDbParameter("@title", OleDbType.VarChar, 100), new OleDbParameter("@img_url", OleDbType.VarChar, (int)byte.MaxValue), new OleDbParameter("@remark", OleDbType.VarChar, 500), new OleDbParameter("@type", OleDbType.Integer, 4), new OleDbParameter("@poundage_type", OleDbType.Integer, 4), new OleDbParameter("@poundage_amount", OleDbType.Decimal, 5), new OleDbParameter("@sort_id", OleDbType.Integer, 4), new OleDbParameter("@is_lock", OleDbType.Integer, 4), new OleDbParameter("@api_path", OleDbType.VarChar, 100), new OleDbParameter("@id", OleDbType.Integer, 4) }; oleDbParameterArray[0].Value = (object)model.title; oleDbParameterArray[1].Value = (object)model.img_url; oleDbParameterArray[2].Value = (object)model.remark; oleDbParameterArray[3].Value = (object)model.type; oleDbParameterArray[4].Value = (object)model.poundage_type; oleDbParameterArray[5].Value = (object)model.poundage_amount; oleDbParameterArray[6].Value = (object)model.sort_id; oleDbParameterArray[7].Value = (object)model.is_lock; oleDbParameterArray[8].Value = (object)model.api_path; oleDbParameterArray[9].Value = (object)model.id; return(DbHelperOleDb.ExecuteSql(stringBuilder.ToString(), oleDbParameterArray) > 0); }
protected void payment_Init(object sender, EventArgs e) { this.action = DTRequest.GetString("action"); this.order_no = DTRequest.GetString("order_no"); if (this.order_no.ToUpper().StartsWith("R")) { this.order_type = DTEnums.AmountTypeEnum.Recharge.ToString().ToLower(); } else if (this.order_no.ToUpper().StartsWith("B")) { this.order_type = DTEnums.AmountTypeEnum.BuyGoods.ToString().ToLower(); } switch (this.action) { case "confirm": if (string.IsNullOrEmpty(this.action) || string.IsNullOrEmpty(this.order_no)) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,URL传输参数有误!")))); break; } this.userModel = new BasePage().GetUserInfo(); if (this.orderConfig.anonymous == 0 || this.order_no.ToUpper().StartsWith("R")) { if (this.userModel == null) { HttpContext.Current.Response.Redirect(this.linkurl(nameof(payment), (object)"?action=login")); break; } } else if (this.userModel == null) { this.userModel = new Rain.Model.users(); } if (this.order_no.ToUpper().StartsWith("R")) { this.rechargeModel = new Rain.BLL.user_recharge().GetModel(this.order_no); if (this.rechargeModel == null) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")))); break; } if (this.rechargeModel.status == 1) { HttpContext.Current.Response.Redirect(this.linkurl(nameof(payment), (object)("?action=succeed&order_no=" + this.rechargeModel.recharge_no))); break; } this.payModel = new Rain.BLL.payment().GetModel(this.rechargeModel.payment_id); if (this.payModel == null) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")))); break; } if (this.payModel.type == 2) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,账户充值不允许线下支付!")))); break; } this.order_amount = this.rechargeModel.amount; break; } if (this.order_no.ToUpper().StartsWith("B")) { this.orderModel = new Rain.BLL.orders().GetModel(this.order_no); if (this.orderModel == null) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")))); break; } if (this.orderModel.payment_status == 2) { HttpContext.Current.Response.Redirect(this.linkurl(nameof(payment), (object)("?action=succeed&order_no=" + this.orderModel.order_no))); break; } this.payModel = new Rain.BLL.payment().GetModel(this.orderModel.payment_id); if (this.payModel == null) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")))); break; } if (this.orderModel.payment_status == 0) { HttpContext.Current.Response.Redirect(this.linkurl(nameof(payment), (object)("?action=succeed&order_no=" + this.orderModel.order_no))); break; } if (this.orderModel.order_amount == new Decimal(0)) { if (!new Rain.BLL.orders().UpdateField(this.orderModel.order_no, "status=2,payment_status=2,payment_time='" + (object)DateTime.Now + "'")) { HttpContext.Current.Response.Redirect(this.linkurl(nameof(payment), (object)"?action=error")); break; } HttpContext.Current.Response.Redirect(this.linkurl(nameof(payment), (object)("?action=succeed&order_no=" + this.orderModel.order_no))); break; } this.order_amount = this.orderModel.order_amount; break; } HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")))); break; case "succeed": if (this.order_no.ToUpper().StartsWith("R")) { this.rechargeModel = new Rain.BLL.user_recharge().GetModel(this.order_no); if (this.rechargeModel != null) { break; } HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")))); break; } if (this.order_no.ToUpper().StartsWith("B")) { this.orderModel = new Rain.BLL.orders().GetModel(this.order_no); if (this.orderModel != null) { break; } HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")))); break; } HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")))); break; } }
public bool Update(Rain.Model.payment model) { return(this.dal.Update(model)); }
public int Add(Rain.Model.payment model) { return(this.dal.Add(model)); }