/// <summary> /// 增加一条数据 /// </summary> public int Add(Cms.Model.wx_payment_wxpay model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into wx_payment_wxpay("); strSql.Append("wid,partnerId,appId,partnerKey,paySignKey,createDate,CertInfoPath,partnerPwd,shName,bankName,bankCode,remark,quicklyFH)"); strSql.Append(" values ("); strSql.Append("@wid,@partnerId,@appId,@partnerKey,@paySignKey,@createDate,@CertInfoPath,@partnerPwd,@shName,@bankName,@bankCode,@remark,@quicklyFH)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@wid", SqlDbType.Int, 4), new SqlParameter("@partnerId", SqlDbType.VarChar, 100), new SqlParameter("@appId", SqlDbType.VarChar, 100), new SqlParameter("@partnerKey", SqlDbType.VarChar, 100), new SqlParameter("@paySignKey", SqlDbType.VarChar, 2000), new SqlParameter("@createDate", SqlDbType.DateTime), new SqlParameter("@CertInfoPath", SqlDbType.VarChar, 1000), new SqlParameter("@partnerPwd", SqlDbType.VarChar, 200), new SqlParameter("@shName", SqlDbType.VarChar, 300), new SqlParameter("@bankName", SqlDbType.VarChar, 300), new SqlParameter("@bankCode", SqlDbType.VarChar, 200), new SqlParameter("@remark", SqlDbType.VarChar, 2000), new SqlParameter("@quicklyFH", SqlDbType.Bit, 1) }; parameters[0].Value = model.wid; parameters[1].Value = model.partnerId; parameters[2].Value = model.appId; parameters[3].Value = model.partnerKey; parameters[4].Value = model.paySignKey; parameters[5].Value = model.createDate; parameters[6].Value = model.CertInfoPath; parameters[7].Value = model.partnerPwd; parameters[8].Value = model.shName; parameters[9].Value = model.bankName; parameters[10].Value = model.bankCode; parameters[11].Value = model.remark; parameters[12].Value = model.quicklyFH; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Cms.Model.wx_payment_wxpay GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,wid,partnerId,appId,partnerKey,paySignKey,createDate,CertInfoPath,partnerPwd,shName,bankName,bankCode,remark,quicklyFH from wx_payment_wxpay "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Cms.Model.wx_payment_wxpay model = new Cms.Model.wx_payment_wxpay(); 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 Cms.Model.wx_payment_wxpay DataRowToModel(DataRow row) { Cms.Model.wx_payment_wxpay model = new Cms.Model.wx_payment_wxpay(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["wid"] != null && row["wid"].ToString() != "") { model.wid = int.Parse(row["wid"].ToString()); } if (row["partnerId"] != null) { model.partnerId = row["partnerId"].ToString(); } if (row["appId"] != null) { model.appId = row["appId"].ToString(); } if (row["partnerKey"] != null) { model.partnerKey = row["partnerKey"].ToString(); } if (row["paySignKey"] != null) { model.paySignKey = row["paySignKey"].ToString(); } if (row["createDate"] != null && row["createDate"].ToString() != "") { model.createDate = DateTime.Parse(row["createDate"].ToString()); } if (row["CertInfoPath"] != null) { model.CertInfoPath = row["CertInfoPath"].ToString(); } if (row["partnerPwd"] != null) { model.partnerPwd = row["partnerPwd"].ToString(); } if (row["shName"] != null) { model.shName = row["shName"].ToString(); } if (row["bankName"] != null) { model.bankName = row["bankName"].ToString(); } if (row["bankCode"] != null) { model.bankCode = row["bankCode"].ToString(); } if (row["remark"] != null) { model.remark = row["remark"].ToString(); } if (row["quicklyFH"] != null && row["quicklyFH"].ToString() != "") { if ((row["quicklyFH"].ToString() == "1") || (row["quicklyFH"].ToString().ToLower() == "true")) { model.quicklyFH = true; } else { model.quicklyFH = false; } } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Cms.Model.wx_payment_wxpay model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update wx_payment_wxpay set "); strSql.Append("wid=@wid,"); strSql.Append("partnerId=@partnerId,"); strSql.Append("appId=@appId,"); strSql.Append("partnerKey=@partnerKey,"); strSql.Append("paySignKey=@paySignKey,"); strSql.Append("createDate=@createDate,"); strSql.Append("CertInfoPath=@CertInfoPath,"); strSql.Append("partnerPwd=@partnerPwd,"); strSql.Append("shName=@shName,"); strSql.Append("bankName=@bankName,"); strSql.Append("bankCode=@bankCode,"); strSql.Append("remark=@remark,"); strSql.Append("quicklyFH=@quicklyFH"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@wid", SqlDbType.Int, 4), new SqlParameter("@partnerId", SqlDbType.VarChar, 100), new SqlParameter("@appId", SqlDbType.VarChar, 100), new SqlParameter("@partnerKey", SqlDbType.VarChar, 100), new SqlParameter("@paySignKey", SqlDbType.VarChar, 2000), new SqlParameter("@createDate", SqlDbType.DateTime), new SqlParameter("@CertInfoPath", SqlDbType.VarChar, 1000), new SqlParameter("@partnerPwd", SqlDbType.VarChar, 200), new SqlParameter("@shName", SqlDbType.VarChar, 300), new SqlParameter("@bankName", SqlDbType.VarChar, 300), new SqlParameter("@bankCode", SqlDbType.VarChar, 200), new SqlParameter("@remark", SqlDbType.VarChar, 2000), new SqlParameter("@quicklyFH", SqlDbType.Bit, 1), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.wid; parameters[1].Value = model.partnerId; parameters[2].Value = model.appId; parameters[3].Value = model.partnerKey; parameters[4].Value = model.paySignKey; parameters[5].Value = model.createDate; parameters[6].Value = model.CertInfoPath; parameters[7].Value = model.partnerPwd; parameters[8].Value = model.shName; parameters[9].Value = model.bankName; parameters[10].Value = model.bankCode; parameters[11].Value = model.remark; parameters[12].Value = model.quicklyFH; parameters[13].Value = model.id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }