/// <summary> /// 得到 wx_shop_user 数据实体 /// </summary> /// <param name="dr">dr</param> /// <returns>wx_shop_user 数据实体</returns> public wx_Shop_UserEntity Populate_wx_Shop_UserEntity_FromDr(IDataReader dr) { wx_Shop_UserEntity Obj = new wx_Shop_UserEntity(); Obj.Id = ((dr["Id"]) == DBNull.Value)?0:Convert.ToInt32(dr["Id"]); Obj.ShopId = ((dr["ShopId"]) == DBNull.Value)?0:Convert.ToInt32(dr["ShopId"]); Obj.UserId = ((dr["UserId"]) == DBNull.Value)?0:Convert.ToInt32(dr["UserId"]); Obj.WeiXinCode = dr["WeiXinCode"].ToString(); return(Obj); }
/// <summary> /// 向数据表wx_Shop_User更新一条记录。 /// </summary> /// <param name="_wx_Shop_UserModel">_wx_Shop_UserModel</param> /// <returns>影响的行数</returns> public int Update(wx_Shop_UserEntity _wx_Shop_UserModel) { string sqlStr = "update wx_Shop_User set [ShopId]=@ShopId,[UserId]=@UserId,[WeiXinCode]=@WeiXinCode where Id=@Id"; SqlParameter[] _param = { new SqlParameter("@Id", SqlDbType.Int), new SqlParameter("@ShopId", SqlDbType.Int), new SqlParameter("@UserId", SqlDbType.Int), new SqlParameter("@WeiXinCode", SqlDbType.VarChar) }; _param[0].Value = _wx_Shop_UserModel.Id; _param[1].Value = _wx_Shop_UserModel.ShopId; _param[2].Value = _wx_Shop_UserModel.UserId; _param[3].Value = _wx_Shop_UserModel.WeiXinCode; return(SqlHelper.ExecuteNonQuery(WebConfig.WfxRW, CommandType.Text, sqlStr, _param)); }
/// <summary> /// 向数据库中插入一条新记录。带事务 /// </summary> /// <param name="sp">事务对象</param> /// <param name="_wx_Shop_UserModel">wx_Shop_User实体</param> /// <returns>新插入记录的编号</returns> public int Insert(SqlTransaction sp, wx_Shop_UserEntity _wx_Shop_UserModel) { string sqlStr = "insert into wx_Shop_User([ShopId],[UserId],[WeiXinCode]) values(@ShopId,@UserId,@WeiXinCode) select @@identity"; int res; SqlParameter[] _param = { new SqlParameter("@ShopId", SqlDbType.Int), new SqlParameter("@UserId", SqlDbType.Int), new SqlParameter("@WeiXinCode", SqlDbType.VarChar) }; _param[0].Value = _wx_Shop_UserModel.ShopId; _param[1].Value = _wx_Shop_UserModel.UserId; _param[2].Value = _wx_Shop_UserModel.WeiXinCode; res = Convert.ToInt32(SqlHelper.ExecuteScalar(sp, CommandType.Text, sqlStr, _param)); return(res); }
/// <summary> /// 得到 wx_shop_user 数据实体 /// </summary> /// <param name="row">row</param> /// <returns>wx_shop_user 数据实体</returns> public wx_Shop_UserEntity Populate_wx_Shop_UserEntity_FromDr(DataRow row) { wx_Shop_UserEntity Obj = new wx_Shop_UserEntity(); if (row != null) { Obj.Id = ((row["Id"]) == DBNull.Value)?0:Convert.ToInt32(row["Id"]); Obj.ShopId = ((row["ShopId"]) == DBNull.Value)?0:Convert.ToInt32(row["ShopId"]); Obj.UserId = ((row["UserId"]) == DBNull.Value)?0:Convert.ToInt32(row["UserId"]); Obj.WeiXinCode = row["WeiXinCode"].ToString(); } else { return(null); } return(Obj); }
/// <summary> /// 通过userid获取店铺用户关系表实体 /// </summary> /// <param name="userid"></param> /// <returns></returns> public wx_Shop_UserEntity GetModelByUserId(int userid) { wx_Shop_UserEntity _obj = null; SqlParameter[] _param = { new SqlParameter("@UserId", SqlDbType.Int) }; _param[0].Value = userid; string sqlStr = "select * from wx_Shop_User with(nolock) where UserId=@UserId"; using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.WfxRW, CommandType.Text, sqlStr, _param)) { while (dr.Read()) { _obj = Populate_wx_Shop_UserEntity_FromDr(dr); } } return(_obj); }
public UserIdentity(string username, string password) { //wx_UsersEntity user = Weifenxiao.BLL.wx_UsersBLL.GetInstance().GetModelByNameAndPwd(username, password); tb_UserEntity user = Jnwf.BLL.tb_UserBLL.GetInstance().GetModelByNameAndPwd(username, password); if (user != null) { wx_Shop_UserEntity shop = Weifenxiao.BLL.wx_Shop_UserBLL.GetInstance().GetModelByUserId(user.ID); //user.LastLoginTime = DateTime.Now; //user.LastLoginIP = HttpContext.Current.Request.UserHostAddress; //User_Account.Update(user); this._name = user.UserID; this._appID = user.AppID; this._userID = user.ID; this._weixinCode = user.WeiXinCode; this._appSecret = user.AppSecret; if (shop != null) { this._shopID = shop.ShopId; } } }
public void Update(wx_Shop_UserEntity wx_Shop_UserEntity) { wx_Shop_Userdal.Update(wx_Shop_UserEntity); }
public int Insert(wx_Shop_UserEntity wx_Shop_UserEntity) { return(wx_Shop_Userdal.Insert(wx_Shop_UserEntity)); }