示例#1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MxWeiXinPF.Model.wx_payment_type model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_payment_type set ");
            strSql.Append("typeCode=@typeCode,");
            strSql.Append("typeName=@typeName,");
            strSql.Append("remark=@remark,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("img_url=@img_url,");
            strSql.Append("api_path=@api_path");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@typeCode", SqlDbType.VarChar,   30),
                new SqlParameter("@typeName", SqlDbType.VarChar,  100),
                new SqlParameter("@remark",   SqlDbType.VarChar, 1500),
                new SqlParameter("@sort_id",  SqlDbType.Int,        4),
                new SqlParameter("@img_url",  SqlDbType.VarChar,  800),
                new SqlParameter("@api_path", SqlDbType.VarChar,  100),
                new SqlParameter("@id",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.typeCode;
            parameters[1].Value = model.typeName;
            parameters[2].Value = model.remark;
            parameters[3].Value = model.sort_id;
            parameters[4].Value = model.img_url;
            parameters[5].Value = model.api_path;
            parameters[6].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MxWeiXinPF.Model.wx_payment_type model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_payment_type(");
            strSql.Append("id,typeCode,typeName,remark,sort_id,img_url,api_path)");
            strSql.Append(" values (");
            strSql.Append("@id,@typeCode,@typeName,@remark,@sort_id,@img_url,@api_path)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",       SqlDbType.Int,        4),
                new SqlParameter("@typeCode", SqlDbType.VarChar,   30),
                new SqlParameter("@typeName", SqlDbType.VarChar,  100),
                new SqlParameter("@remark",   SqlDbType.VarChar, 1500),
                new SqlParameter("@sort_id",  SqlDbType.Int,        4),
                new SqlParameter("@img_url",  SqlDbType.VarChar,  800),
                new SqlParameter("@api_path", SqlDbType.VarChar, 100)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.typeCode;
            parameters[2].Value = model.typeName;
            parameters[3].Value = model.remark;
            parameters[4].Value = model.sort_id;
            parameters[5].Value = model.img_url;
            parameters[6].Value = model.api_path;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_payment_type DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_payment_type model = new MxWeiXinPF.Model.wx_payment_type();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["typeCode"] != null)
         {
             model.typeCode = row["typeCode"].ToString();
         }
         if (row["typeName"] != null)
         {
             model.typeName = row["typeName"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["sort_id"] != null && row["sort_id"].ToString() != "")
         {
             model.sort_id = int.Parse(row["sort_id"].ToString());
         }
         if (row["img_url"] != null)
         {
             model.img_url = row["img_url"].ToString();
         }
         if (row["api_path"] != null)
         {
             model.api_path = row["api_path"].ToString();
         }
     }
     return(model);
 }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_payment_type GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,typeCode,typeName,remark,sort_id,img_url,api_path from wx_payment_type ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_payment_type DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_payment_type model=new MxWeiXinPF.Model.wx_payment_type();
     if (row != null)
     {
         if(row["id"]!=null && row["id"].ToString()!="")
         {
             model.id=int.Parse(row["id"].ToString());
         }
         if(row["typeCode"]!=null)
         {
             model.typeCode=row["typeCode"].ToString();
         }
         if(row["typeName"]!=null)
         {
             model.typeName=row["typeName"].ToString();
         }
         if(row["remark"]!=null)
         {
             model.remark=row["remark"].ToString();
         }
         if(row["sort_id"]!=null && row["sort_id"].ToString()!="")
         {
             model.sort_id=int.Parse(row["sort_id"].ToString());
         }
         if(row["img_url"]!=null)
         {
             model.img_url=row["img_url"].ToString();
         }
         if(row["api_path"]!=null)
         {
             model.api_path=row["api_path"].ToString();
         }
     }
     return model;
 }
示例#6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_payment_type GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 id,typeCode,typeName,remark,sort_id,img_url,api_path from wx_payment_type ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)			};
            parameters[0].Value = id;

            MxWeiXinPF.Model.wx_payment_type model=new MxWeiXinPF.Model.wx_payment_type();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }