Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XCWeiXin.Model.wx_payment_alipay model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_payment_alipay set ");
            strSql.Append("wid=@wid,");
            strSql.Append("ownerName=@ownerName,");
            strSql.Append("partner=@partner,");
            strSql.Append("e_key=@e_key,");
            strSql.Append("private_key=@private_key,");
            strSql.Append("public_key=@public_key,");
            strSql.Append("sign_type=@sign_type,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("extInt=@extInt,");
            strSql.Append("extStr=@extStr,");
            strSql.Append("extStr2=@extStr2");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",         SqlDbType.Int,          4),
                new SqlParameter("@ownerName",   SqlDbType.VarChar,    100),
                new SqlParameter("@partner",     SqlDbType.VarChar,     32),
                new SqlParameter("@e_key",       SqlDbType.VarChar,     64),
                new SqlParameter("@private_key", SqlDbType.VarChar,   2000),
                new SqlParameter("@public_key",  SqlDbType.VarChar,   2000),
                new SqlParameter("@sign_type",   SqlDbType.VarChar,   4000),
                new SqlParameter("@createDate",  SqlDbType.DateTime),
                new SqlParameter("@extInt",      SqlDbType.Int,          4),
                new SqlParameter("@extStr",      SqlDbType.VarChar,    500),
                new SqlParameter("@extStr2",     SqlDbType.VarChar,   1000),
                new SqlParameter("@id",          SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.ownerName;
            parameters[2].Value  = model.partner;
            parameters[3].Value  = model.e_key;
            parameters[4].Value  = model.private_key;
            parameters[5].Value  = model.public_key;
            parameters[6].Value  = model.sign_type;
            parameters[7].Value  = model.createDate;
            parameters[8].Value  = model.extInt;
            parameters[9].Value  = model.extStr;
            parameters[10].Value = model.extStr2;
            parameters[11].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XCWeiXin.Model.wx_payment_alipay DataRowToModel(DataRow row)
 {
     XCWeiXin.Model.wx_payment_alipay model = new XCWeiXin.Model.wx_payment_alipay();
     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["ownerName"] != null)
         {
             model.ownerName = row["ownerName"].ToString();
         }
         if (row["partner"] != null)
         {
             model.partner = row["partner"].ToString();
         }
         if (row["e_key"] != null)
         {
             model.e_key = row["e_key"].ToString();
         }
         if (row["private_key"] != null)
         {
             model.private_key = row["private_key"].ToString();
         }
         if (row["public_key"] != null)
         {
             model.public_key = row["public_key"].ToString();
         }
         if (row["sign_type"] != null)
         {
             model.sign_type = row["sign_type"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["extInt"] != null && row["extInt"].ToString() != "")
         {
             model.extInt = int.Parse(row["extInt"].ToString());
         }
         if (row["extStr"] != null)
         {
             model.extStr = row["extStr"].ToString();
         }
         if (row["extStr2"] != null)
         {
             model.extStr2 = row["extStr2"].ToString();
         }
     }
     return(model);
 }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(XCWeiXin.Model.wx_payment_alipay model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_payment_alipay(");
            strSql.Append("wid,ownerName,partner,e_key,private_key,public_key,sign_type,createDate,extInt,extStr,extStr2)");
            strSql.Append(" values (");
            strSql.Append("@wid,@ownerName,@partner,@e_key,@private_key,@public_key,@sign_type,@createDate,@extInt,@extStr,@extStr2)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",         SqlDbType.Int,          4),
                new SqlParameter("@ownerName",   SqlDbType.VarChar,    100),
                new SqlParameter("@partner",     SqlDbType.VarChar,     32),
                new SqlParameter("@e_key",       SqlDbType.VarChar,     64),
                new SqlParameter("@private_key", SqlDbType.VarChar,   2000),
                new SqlParameter("@public_key",  SqlDbType.VarChar,   2000),
                new SqlParameter("@sign_type",   SqlDbType.VarChar,   4000),
                new SqlParameter("@createDate",  SqlDbType.DateTime),
                new SqlParameter("@extInt",      SqlDbType.Int,          4),
                new SqlParameter("@extStr",      SqlDbType.VarChar,    500),
                new SqlParameter("@extStr2",     SqlDbType.VarChar, 1000)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.ownerName;
            parameters[2].Value  = model.partner;
            parameters[3].Value  = model.e_key;
            parameters[4].Value  = model.private_key;
            parameters[5].Value  = model.public_key;
            parameters[6].Value  = model.sign_type;
            parameters[7].Value  = model.createDate;
            parameters[8].Value  = model.extInt;
            parameters[9].Value  = model.extStr;
            parameters[10].Value = model.extStr2;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XCWeiXin.Model.wx_payment_alipay GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,wid,ownerName,partner,e_key,private_key,public_key,sign_type,createDate,extInt,extStr,extStr2 from wx_payment_alipay ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            XCWeiXin.Model.wx_payment_alipay model = new XCWeiXin.Model.wx_payment_alipay();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }