public tb_App_UserEntity Get_tb_App_UserEntity(string openid, string weixincode, int status)
        {
            tb_App_UserEntity _obj = null;

            SqlParameter[] _param =
            {
                new SqlParameter("@openid",     SqlDbType.VarChar, 50),
                new SqlParameter("@weixincode", SqlDbType.VarChar, 50),
                new SqlParameter("@status",     SqlDbType.Int)
            };
            _param[0].Value = openid;
            _param[1].Value = weixincode;
            _param[2].Value = status;

            string sqlStr = "select * from tb_App_User with(nolock) where WeiXinCode=@weixincode and OpenID=@openid and Status=@status";

            using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.weixinRW, CommandType.Text, sqlStr, _param))
            {
                while (dr.Read())
                {
                    _obj = Populate_tb_App_UserEntity_FromDr(dr);
                }
            }
            return(_obj);
        }
Exemple #2
0
        public int Insert(tb_App_UserEntity tb_App_UserEntity)
        {
            int rows = tb_App_Userdal.Insert(tb_App_UserEntity);

            //MemcacheHelper.input("{" + string.Format(act, active.add, table.appuser, rows, "", key.appuser) + "}");
            //MemcacheHelper.input("{" + string.Format(act, active.add, table.openuser, 0, tb_App_UserEntity.OpenID, key.openuser) + "}");

            return(rows);
        }
Exemple #3
0
        public tb_App_UserEntity GetModelByCache(string openid)
        {
            string            key   = "appuser" + openid;
            tb_App_UserEntity model = null;
            object            obj   = MemcacheHelper.Get(key);

            if (obj != null)
            {
                model = Jnwf.Utils.Json.JsonHelper.DeserializeJson <tb_App_UserEntity>(obj.ToString());
            }
            return(model);
        }
Exemple #4
0
        /// <summary>
        /// 得到  tb_app_user 数据实体
        /// </summary>
        /// <param name="dr">dr</param>
        /// <returns>tb_app_user 数据实体</returns>
        public tb_App_UserEntity Populate_tb_App_UserEntity_FromDr(IDataReader dr)
        {
            tb_App_UserEntity Obj = new tb_App_UserEntity();

            Obj.ID         = ((dr["ID"]) == DBNull.Value)?0:Convert.ToInt32(dr["ID"]);
            Obj.WeiXinCode = dr["WeiXinCode"].ToString();
            Obj.OpenID     = dr["OpenID"].ToString();
            Obj.Status     = ((dr["Status"]) == DBNull.Value)?0:Convert.ToInt32(dr["Status"]);
            Obj.AddTime    = ((dr["AddTime"]) == DBNull.Value)?Convert.ToDateTime("1900-1-1"):Convert.ToDateTime(dr["AddTime"]);
            Obj.UpdateTime = ((dr["UpdateTime"]) == DBNull.Value)?Convert.ToDateTime("1900-1-1"):Convert.ToDateTime(dr["UpdateTime"]);
            Obj.Recommend  = dr["Recommend"].ToString();

            return(Obj);
        }
        public int InsertProcedure(tb_App_UserEntity _tb_App_UserModel)
        {
            int res;

            SqlParameter[] _param =
            {
                new SqlParameter("@WeiXinCode", SqlDbType.VarChar),
                new SqlParameter("@OpenID",     SqlDbType.VarChar),
                new SqlParameter("@Status",     SqlDbType.Int),
                new SqlParameter("@Recommend",  SqlDbType.VarChar)
            };
            _param[0].Value = _tb_App_UserModel.WeiXinCode;
            _param[1].Value = _tb_App_UserModel.OpenID;
            _param[2].Value = _tb_App_UserModel.Status;
            _param[3].Value = _tb_App_UserModel.Recommend;

            res = Convert.ToInt32(SqlHelper.ExecuteScalar(WebConfig.weixinRW, CommandType.StoredProcedure, "pro_Add_App_User", _param));
            return(res);
        }
Exemple #6
0
        /// <summary>
        /// 根据ID,返回一个tb_App_User对象
        /// </summary>
        /// <param name="iD">iD</param>
        /// <returns>tb_App_User对象</returns>
        public tb_App_UserEntity Get_tb_App_UserEntity(int iD)
        {
            tb_App_UserEntity _obj = null;

            SqlParameter[] _param =
            {
                new SqlParameter("@ID", SqlDbType.Int)
            };
            _param[0].Value = iD;
            string sqlStr = "select * from tb_App_User with(nolock) where ID=@ID";

            using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.weixinRW, CommandType.Text, sqlStr, _param))
            {
                while (dr.Read())
                {
                    _obj = Populate_tb_App_UserEntity_FromDr(dr);
                }
            }
            return(_obj);
        }
Exemple #7
0
        /// <summary>
        /// 得到  tb_app_user 数据实体
        /// </summary>
        /// <param name="row">row</param>
        /// <returns>tb_app_user 数据实体</returns>
        public tb_App_UserEntity Populate_tb_App_UserEntity_FromDr(DataRow row)
        {
            tb_App_UserEntity Obj = new tb_App_UserEntity();

            if (row != null)
            {
                Obj.ID         = ((row["ID"]) == DBNull.Value)?0:Convert.ToInt32(row["ID"]);
                Obj.WeiXinCode = row["WeiXinCode"].ToString();
                Obj.OpenID     = row["OpenID"].ToString();
                Obj.Status     = ((row["Status"]) == DBNull.Value)?0:Convert.ToInt32(row["Status"]);
                Obj.AddTime    = ((row["AddTime"]) == DBNull.Value)?Convert.ToDateTime("1900-1-1"):Convert.ToDateTime(row["AddTime"]);
                Obj.UpdateTime = ((row["UpdateTime"]) == DBNull.Value)?Convert.ToDateTime("1900-1-1"):Convert.ToDateTime(row["UpdateTime"]);
                Obj.Recommend  = row["Recommend"].ToString();
            }
            else
            {
                return(null);
            }
            return(Obj);
        }
        public tb_App_UserEntity GetModelByOpenId(string openid)
        {
            tb_App_UserEntity _obj = null;

            SqlParameter[] _param =
            {
                new SqlParameter("@openid", SqlDbType.VarChar)
            };
            _param[0].Value = openid;

            string sqlStr = "select * from tb_App_User with(nolock) where openid=@openid and Status=1";

            using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.weixinRW, CommandType.Text, sqlStr, _param))
            {
                while (dr.Read())
                {
                    _obj = Populate_tb_App_UserEntity_FromDr(dr);
                }
            }
            return(_obj);
        }
Exemple #9
0
        /// <summary>
        /// 向数据库中插入一条新记录。带事务
        /// </summary>
        /// <param name="sp">事务对象</param>
        /// <param name="_tb_App_UserModel">tb_App_User实体</param>
        /// <returns>新插入记录的编号</returns>
        public int Insert(SqlTransaction sp, tb_App_UserEntity _tb_App_UserModel)
        {
            string sqlStr = "insert into tb_App_User([WeiXinCode],[OpenID],[Status],[AddTime],[UpdateTime],[Recommend]) values(@WeiXinCode,@OpenID,@Status,@AddTime,@UpdateTime,@Recommend) select @@identity";
            int    res;

            SqlParameter[] _param =
            {
                new SqlParameter("@WeiXinCode", SqlDbType.VarChar),
                new SqlParameter("@OpenID",     SqlDbType.VarChar),
                new SqlParameter("@Status",     SqlDbType.Int),
                new SqlParameter("@AddTime",    SqlDbType.DateTime),
                new SqlParameter("@UpdateTime", SqlDbType.DateTime),
                new SqlParameter("@Recommend",  SqlDbType.VarChar)
            };
            _param[0].Value = _tb_App_UserModel.WeiXinCode;
            _param[1].Value = _tb_App_UserModel.OpenID;
            _param[2].Value = _tb_App_UserModel.Status;
            _param[3].Value = _tb_App_UserModel.AddTime;
            _param[4].Value = _tb_App_UserModel.UpdateTime;
            _param[5].Value = _tb_App_UserModel.Recommend;
            res             = Convert.ToInt32(SqlHelper.ExecuteScalar(sp, CommandType.Text, sqlStr, _param));
            return(res);
        }
Exemple #10
0
        /// <summary>
        /// 向数据表tb_App_User更新一条记录。带事务
        /// </summary>
        /// <param name="sp">事务对象</param>
        /// <param name="_tb_App_UserModel">_tb_App_UserModel</param>
        /// <returns>影响的行数</returns>
        public int Update(SqlTransaction sp, tb_App_UserEntity _tb_App_UserModel)
        {
            string sqlStr = "update tb_App_User set [WeiXinCode]=@WeiXinCode,[OpenID]=@OpenID,[Status]=@Status,[AddTime]=@AddTime,[UpdateTime]=@UpdateTime,[Recommend]=@Recommend where ID=@ID";

            SqlParameter[] _param =
            {
                new SqlParameter("@ID",         SqlDbType.Int),
                new SqlParameter("@WeiXinCode", SqlDbType.VarChar),
                new SqlParameter("@OpenID",     SqlDbType.VarChar),
                new SqlParameter("@Status",     SqlDbType.Int),
                new SqlParameter("@AddTime",    SqlDbType.DateTime),
                new SqlParameter("@UpdateTime", SqlDbType.DateTime),
                new SqlParameter("@Recommend",  SqlDbType.VarChar)
            };
            _param[0].Value = _tb_App_UserModel.ID;
            _param[1].Value = _tb_App_UserModel.WeiXinCode;
            _param[2].Value = _tb_App_UserModel.OpenID;
            _param[3].Value = _tb_App_UserModel.Status;
            _param[4].Value = _tb_App_UserModel.AddTime;
            _param[5].Value = _tb_App_UserModel.UpdateTime;
            _param[6].Value = _tb_App_UserModel.Recommend;
            return(SqlHelper.ExecuteNonQuery(sp, CommandType.Text, sqlStr, _param));
        }
Exemple #11
0
 public void Update(tb_App_UserEntity tb_App_UserEntity)
 {
     tb_App_Userdal.Update(tb_App_UserEntity);
 }
Exemple #12
0
 public int InsertProcedure(tb_App_UserEntity _tb_App_UserModel)
 {
     return(tb_App_Userdal.InsertProcedure(_tb_App_UserModel));
 }