Пример #1
0
        /// <summary>
        /// 该用户的中奖信息
        /// </summary>
        public WeiXinPF.Model.wx_ggkAwardUser getZJinfoByOpenid(int actId, string openid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,actId,uName,uTel,openid,jxName,jpName,createDate,hasLingQu,sn from wx_ggkAwardUser ");
            strSql.Append(" where actId=@actId and openid=@openid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@actId",  SqlDbType.Int,       4),
                new SqlParameter("@openid", SqlDbType.VarChar, 100),
            };
            parameters[0].Value = actId;
            parameters[1].Value = openid;

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

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WeiXinPF.Model.wx_ggkAwardUser DataRowToModel(DataRow row)
 {
     WeiXinPF.Model.wx_ggkAwardUser model = new WeiXinPF.Model.wx_ggkAwardUser();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["actId"] != null && row["actId"].ToString() != "")
         {
             model.actId = int.Parse(row["actId"].ToString());
         }
         if (row["uName"] != null)
         {
             model.uName = row["uName"].ToString();
         }
         if (row["uTel"] != null)
         {
             model.uTel = row["uTel"].ToString();
         }
         if (row["openid"] != null)
         {
             model.openid = row["openid"].ToString();
         }
         if (row["jxName"] != null)
         {
             model.jxName = row["jxName"].ToString();
         }
         if (row["jpName"] != null)
         {
             model.jpName = row["jpName"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["hasLingQu"] != null && row["hasLingQu"].ToString() != "")
         {
             if ((row["hasLingQu"].ToString() == "1") || (row["hasLingQu"].ToString().ToLower() == "true"))
             {
                 model.hasLingQu = true;
             }
             else
             {
                 model.hasLingQu = false;
             }
         }
         if (row["sn"] != null)
         {
             model.sn = row["sn"].ToString();
         }
     }
     return(model);
 }
Пример #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WeiXinPF.Model.wx_ggkAwardUser model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_ggkAwardUser set ");
            strSql.Append("actId=@actId,");
            strSql.Append("uName=@uName,");
            strSql.Append("uTel=@uTel,");
            strSql.Append("openid=@openid,");
            strSql.Append("jxName=@jxName,");
            strSql.Append("jpName=@jpName,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("hasLingQu=@hasLingQu,");
            strSql.Append("sn=@sn");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@actId",      SqlDbType.Int,         4),
                new SqlParameter("@uName",      SqlDbType.VarChar,    50),
                new SqlParameter("@uTel",       SqlDbType.VarChar,   500),
                new SqlParameter("@openid",     SqlDbType.VarChar,   100),
                new SqlParameter("@jxName",     SqlDbType.VarChar,    50),
                new SqlParameter("@jpName",     SqlDbType.VarChar,   200),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@hasLingQu",  SqlDbType.Bit,         1),
                new SqlParameter("@sn",         SqlDbType.VarChar,   100),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.actId;
            parameters[1].Value = model.uName;
            parameters[2].Value = model.uTel;
            parameters[3].Value = model.openid;
            parameters[4].Value = model.jxName;
            parameters[5].Value = model.jpName;
            parameters[6].Value = model.createDate;
            parameters[7].Value = model.hasLingQu;
            parameters[8].Value = model.sn;
            parameters[9].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WeiXinPF.Model.wx_ggkAwardUser model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_ggkAwardUser(");
            strSql.Append("actId,uName,uTel,openid,jxName,jpName,createDate,hasLingQu,sn)");
            strSql.Append(" values (");
            strSql.Append("@actId,@uName,@uTel,@openid,@jxName,@jpName,@createDate,@hasLingQu,@sn)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@actId",      SqlDbType.Int,         4),
                new SqlParameter("@uName",      SqlDbType.VarChar,    50),
                new SqlParameter("@uTel",       SqlDbType.VarChar,   500),
                new SqlParameter("@openid",     SqlDbType.VarChar,   100),
                new SqlParameter("@jxName",     SqlDbType.VarChar,    50),
                new SqlParameter("@jpName",     SqlDbType.VarChar,   200),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@hasLingQu",  SqlDbType.Bit,         1),
                new SqlParameter("@sn",         SqlDbType.VarChar, 100)
            };
            parameters[0].Value = model.actId;
            parameters[1].Value = model.uName;
            parameters[2].Value = model.uTel;
            parameters[3].Value = model.openid;
            parameters[4].Value = model.jxName;
            parameters[5].Value = model.jpName;
            parameters[6].Value = model.createDate;
            parameters[7].Value = model.hasLingQu;
            parameters[8].Value = model.sn;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Пример #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WeiXinPF.Model.wx_ggkAwardUser GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,actId,uName,uTel,openid,jxName,jpName,createDate,hasLingQu,sn from wx_ggkAwardUser ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

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