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

            strSql.Append("update wx_diancai_form_result set ");
            strSql.Append("shopinfoId=@shopinfoId,");
            strSql.Append("openid=@openid,");
            strSql.Append("cName=@cName,");
            strSql.Append("cId=@cId,");
            strSql.Append("userResult=@userResult,");
            strSql.Append("createDate=@createDate");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@shopinfoId", SqlDbType.Int,          4),
                new SqlParameter("@openid",     SqlDbType.VarChar,    100),
                new SqlParameter("@cName",      SqlDbType.VarChar,    100),
                new SqlParameter("@cId",        SqlDbType.Int,          4),
                new SqlParameter("@userResult", SqlDbType.VarChar,   2000),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.shopinfoId;
            parameters[1].Value = model.openid;
            parameters[2].Value = model.cName;
            parameters[3].Value = model.cId;
            parameters[4].Value = model.userResult;
            parameters[5].Value = model.createDate;
            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 int Add(MxWeiXinPF.Model.wx_diancai_form_result model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_diancai_form_result(");
            strSql.Append("shopinfoId,openid,cName,cId,userResult,createDate)");
            strSql.Append(" values (");
            strSql.Append("@shopinfoId,@openid,@cName,@cId,@userResult,@createDate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@shopinfoId", SqlDbType.Int,        4),
                new SqlParameter("@openid",     SqlDbType.VarChar,  100),
                new SqlParameter("@cName",      SqlDbType.VarChar,  100),
                new SqlParameter("@cId",        SqlDbType.Int,        4),
                new SqlParameter("@userResult", SqlDbType.VarChar, 2000),
                new SqlParameter("@createDate", SqlDbType.DateTime)
            };
            parameters[0].Value = model.shopinfoId;
            parameters[1].Value = model.openid;
            parameters[2].Value = model.cName;
            parameters[3].Value = model.cId;
            parameters[4].Value = model.userResult;
            parameters[5].Value = model.createDate;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_diancai_form_result DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_diancai_form_result model = new MxWeiXinPF.Model.wx_diancai_form_result();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["shopinfoId"] != null && row["shopinfoId"].ToString() != "")
         {
             model.shopinfoId = int.Parse(row["shopinfoId"].ToString());
         }
         if (row["openid"] != null)
         {
             model.openid = row["openid"].ToString();
         }
         if (row["cName"] != null)
         {
             model.cName = row["cName"].ToString();
         }
         if (row["cId"] != null && row["cId"].ToString() != "")
         {
             model.cId = int.Parse(row["cId"].ToString());
         }
         if (row["userResult"] != null)
         {
             model.userResult = row["userResult"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_diancai_form_result GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,shopinfoId,openid,cName,cId,userResult,createDate from wx_diancai_form_result ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            MxWeiXinPF.Model.wx_diancai_form_result model = new MxWeiXinPF.Model.wx_diancai_form_result();
            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_diancai_form_result DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_diancai_form_result model=new MxWeiXinPF.Model.wx_diancai_form_result();
     if (row != null)
     {
         if(row["id"]!=null && row["id"].ToString()!="")
         {
             model.id=int.Parse(row["id"].ToString());
         }
         if(row["shopinfoId"]!=null && row["shopinfoId"].ToString()!="")
         {
             model.shopinfoId=int.Parse(row["shopinfoId"].ToString());
         }
         if(row["openid"]!=null)
         {
             model.openid=row["openid"].ToString();
         }
         if(row["cName"]!=null)
         {
             model.cName=row["cName"].ToString();
         }
         if(row["cId"]!=null && row["cId"].ToString()!="")
         {
             model.cId=int.Parse(row["cId"].ToString());
         }
         if(row["userResult"]!=null)
         {
             model.userResult=row["userResult"].ToString();
         }
         if(row["createDate"]!=null && row["createDate"].ToString()!="")
         {
             model.createDate=DateTime.Parse(row["createDate"].ToString());
         }
     }
     return model;
 }
コード例 #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_diancai_form_result GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 id,shopinfoId,openid,cName,cId,userResult,createDate from wx_diancai_form_result ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

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