/// <summary> /// 更新一条数据 /// </summary> public bool Update(lgk.Model.tb_TrainBackUrl model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_TrainBackUrl set "); strSql.Append("SubmitCallback=@SubmitCallback,"); strSql.Append("CompanName=@CompanName,"); strSql.Append("PayCallback=@PayCallback,"); strSql.Append("RefundCallback=@RefundCallback"); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@SubmitCallback", SqlDbType.VarChar, 100), new SqlParameter("@CompanName", SqlDbType.VarChar, 100), new SqlParameter("@PayCallback", SqlDbType.VarChar, 100), new SqlParameter("@RefundCallback", SqlDbType.VarChar, 100), new SqlParameter("@ID", SqlDbType.Int) }; parameters[0].Value = model.SubmitCallback; parameters[1].Value = model.CompanName; parameters[2].Value = model.PayCallback; parameters[3].Value = model.RefundCallback; parameters[4].Value = model.ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(lgk.Model.tb_TrainBackUrl model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tb_TrainBackUrl("); strSql.Append("SubmitCallback,CompanName,PayCallback,RefundCallback)"); strSql.Append(" values ("); strSql.Append("@SubmitCallback,@CompanName,@PayCallback,@RefundCallback)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@SubmitCallback", SqlDbType.VarChar, 100), new SqlParameter("@CompanName", SqlDbType.VarChar, 100), new SqlParameter("@PayCallback", SqlDbType.VarChar, 100), new SqlParameter("@RefundCallback", SqlDbType.VarChar, 100) }; parameters[0].Value = model.SubmitCallback; parameters[1].Value = model.CompanName; parameters[2].Value = model.PayCallback; parameters[3].Value = model.RefundCallback; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
private void BindData() { lgk.Model.tb_TrainBackUrl model = tback.GetModel(""); if (model != null) { city.Value = model.SubmitCallback; text1.Value = model.CompanName; textName.Value = model.PayCallback; textCode.Value = model.RefundCallback; } }
protected void LinkButton2_Click(object sender, EventArgs e) { try { if (city.Value == "") { MessageBox.Show(this.Page, "占座回调地址不能为空"); return; } if (text1.Value == "") { MessageBox.Show(this.Page, "公司名称不能为空"); return; } if (textName.Value == "") { MessageBox.Show(this.Page, "出票回调地址不能为空"); return; } if (textCode.Value == "") { MessageBox.Show(this.Page, "退款回调地址不能为空"); return; } //提交前先删除原来的地址 if (tback.Delete()) { lgk.Model.tb_TrainBackUrl model = new lgk.Model.tb_TrainBackUrl(); model.SubmitCallback = city.Value; model.CompanName = text1.Value; model.PayCallback = textName.Value; model.RefundCallback = textCode.Value; if (tback.Add(model) > 0) { MessageBox.Show(this.Page, "提交成功"); } else { MessageBox.Show(this.Page, "提交失败"); } } else { MessageBox.Show(this.Page, "删除来的地址失败"); } } catch (Exception ex) { MessageBox.Show(this.Page, "系统异常,异常信息:" + ex.Message); } }
public lgk.Model.tb_TrainBackUrl GetModel(string where) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from tb_TrainBackUrl t "); if (where != "") { strSql.Append(" where " + where); } lgk.Model.tb_TrainBackUrl model = new lgk.Model.tb_TrainBackUrl(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), null); if (ds.Tables[0].Rows.Count > 0) { 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]["SubmitCallback"] != null && ds.Tables[0].Rows[0]["SubmitCallback"].ToString() != "") { model.SubmitCallback = ds.Tables[0].Rows[0]["SubmitCallback"].ToString(); } if (ds.Tables[0].Rows[0]["CompanName"] != null && ds.Tables[0].Rows[0]["CompanName"].ToString() != "") { model.CompanName = ds.Tables[0].Rows[0]["CompanName"].ToString(); } if (ds.Tables[0].Rows[0]["PayCallback"] != null && ds.Tables[0].Rows[0]["PayCallback"].ToString() != "") { model.PayCallback = ds.Tables[0].Rows[0]["PayCallback"].ToString(); } if (ds.Tables[0].Rows[0]["RefundCallback"] != null && ds.Tables[0].Rows[0]["RefundCallback"].ToString() != "") { model.RefundCallback = ds.Tables[0].Rows[0]["RefundCallback"].ToString(); } return(model); } else { return(null); } }
/// <summary> /// 提交订单处理 /// </summary> /// <param name="dic"></param> /// <param name="dic1"></param> /// <param name="dic2"></param> /// <returns></returns> public string Submit(Dictionary <string, string> dic, Dictionary <string, string> dic1, Dictionary <string, string> dic2) { decimal money = Convert.ToDecimal(dic["allprice"].ToString()); decimal banlcen = bllaccount.BanlceAcount("TrainAccount"); if (banlcen >= money) { dic2.Add("UserID", dic["UserID"].ToString()); dic2.Add("FromStationName", dic["FromStationName"].ToString()); dic2.Add("ToStationName", dic["ToStationName"].ToString()); dic2.Add("FromStationDate", dic["FromStationDate"].ToString()); dic2.Add("ToStationDate", dic["ToStationDate"].ToString()); dic2.Add("OrderPrice", money.ToString()); dic2.Add("LinkMan", dic["LinkMan"].ToString()); dic2.Add("LinkPhone", dic["LinkPhone"].ToString()); lgk.Model.tb_user usermodel = userBLL.GetModel(Convert.ToInt32(dic["UserID"].ToLower())); if (usermodel.Emoney >= money) { //提交订单到接口 string respon = RequestSumit(dic2, dic1["RequestUrl"].ToString(), dic["act"].ToLower()); if (respon != "error") { var Result = JsonConvert.DeserializeObject <RespondResult>(respon); if (Result.result != null) { dic2.Add("OrderID", Result.result.orderid); //提交订单成功添加到本地订单 OrderHandle(dic2); //扣除奖励分 // Bonus(usermodel, money); //提交回调地址到接口 Dictionary <string, string> dicback = new Dictionary <string, string>(); lgk.Model.tb_TrainBackUrl backurl = back.GetModel(""); if (backurl != null) { dicback.Add("dtype", dtype); dicback.Add("key", AppKey); dicback.Add("submit_callback", backurl.SubmitCallback); dicback.Add("pay_callback", backurl.PayCallback); dicback.Add("refund_callback", backurl.RefundCallback); dicback.Add("name", backurl.CompanName); string responBack = RequestSumit(dicback, setPushUrl, "setpush"); var backmodel = JsonConvert.DeserializeObject <RespondResult>(responBack); if (backmodel.error_code != "0") { respon = "{\"reason\":\"success\",\"error_code\":\"0\",\"info\":\"推送回调地址失败\"}"; } } else { respon = "{\"reason\":\"success\",\"error_code\":\"0\",\"info\":\"推送回调地址为空\"}"; } } return(respon); } else { return("error"); } } else { return("{\"reason\":\"error\",\"error_code\":\"1\",\"info\":\"奖励分余额不足\"}"); } } else { return("{\"reason\":\"error\",\"error_code\":\"1\",\"info\":\"该功能正在维护中\"}"); //return "{\"reason\":\"error\",\"error_code\":\"1\",\"info\":\"平台余额不足,该功能已暂停使\"}"; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(lgk.Model.tb_TrainBackUrl model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(lgk.Model.tb_TrainBackUrl model) { return(dal.Add(model)); }