//显示用户昵称头像
        private void showUserInfo()
        {
            AppUserInfoBiz userInfoBiz = new AppUserInfoBiz();
            string         openId      = GetUData.OpenId;
            DataSet        result      = userInfoBiz.ExecuteSqlToDataSet("EXEC	[TireTreasureDB].[dbo].[proc_GetUserInfoByWeiXinId] '"+ openId + "'");

            if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0)
            {
                ViewBag.nickName   = result.Tables[0].Rows[0]["Nickname"].ToString();
                ViewBag.headImgUrl = result.Tables[0].Rows[0]["ImgeUrl"].ToString();
            }
        }
        //添加用户信息到表
        private void addUserInfo(DateTime now, Guid guid, LoginModel model)
        {
            AppUserInfo userInfo = new AppUserInfo();

            userInfo.AppUserInfoId = Guid.NewGuid();
            userInfo.UserId        = guid;
            //特殊字符过滤
            userInfo.Phone    = FilterTools.FilterSpecial(model.Phone);
            userInfo.Nickname = FilterTools.FilterSpecial(GetUData.Nick_Name);
            userInfo.ImgeUrl  = GetUData.Head_Img_Url;

            userInfo.ReferencesId = GetUData.User_Id;

            userInfo.AddTime    = now;
            userInfo.UpdateTime = now;
            userInfo.isDeleted  = false;

            AppUserInfoBiz userInfoBiz = new AppUserInfoBiz();

            userInfoBiz.Add(userInfo);
        }
Example #3
0
        //同意

        public ActionResult agree()
        {
            string src = Request["src"];

            AppUserInfoBiz appUserInfoBiz = new AppUserInfoBiz();
            DataSet        result         = appUserInfoBiz.ExecuteSqlToDataSet("SELECT UserId FROM [TireTreasureDB].[dbo].[TT_AppUserInfo] where  ImgeUrl= '" + src + "'");

            if (result.Tables[0].Rows.Count > 0)
            {
                RequestFriendsBiz requestFriendsBiz = new RequestFriendsBiz();
                requestFriendsBiz.ExecuteSqlToDataSet("EXEC [TireTreasureDB].[dbo].[proc_UpdateRequestFriendsSates] '" + GetUData.OpenId + "'," + ConstantList.ADD_FRIENDS_STATUS_SUCCESS + "");

                Guid user = (Guid)result.Tables[0].Rows[0]["UserId"];
                result = requestFriendsBiz.ExecuteSqlToDataSet("SELECT UserId FROM [TireTreasureDB].[dbo].[TT_User] where  WeiXinId= '" + GetUData.OpenId + "'");

                DateTime now     = DateTime.Now;
                Friends  friends = new Friends();

                friends.FriendsId  = Guid.NewGuid();
                friends.UserId     = user;
                friends.ToUserId   = (Guid)result.Tables[0].Rows[0]["UserId"];
                friends.isDeleted  = false;
                friends.ByWay      = ConstantList.FRIEND_TYPE_SEARCH;
                friends.BlackList  = false;
                friends.AddTime    = now;
                friends.UpdateTime = now;

                FriendsBiz friendsBiz = new FriendsBiz();
                friendsBiz.Add(friends);

                friends.FriendsId = Guid.NewGuid();
                friends.UserId    = (Guid)result.Tables[0].Rows[0]["UserId"];
                friends.ToUserId  = user;
                friendsBiz.Add(friends);
            }
            return(RedirectToAction("Index", "Friends"));
        }
Example #4
0
        //显示搜索用户信息
        public ActionResult showUserInfo()
        {
            string  loginName = this.TempData["LonginName"] as string;
            string  openId    = null;
            UserBiz userBiz   = new UserBiz();
            DataSet result    = userBiz.ExecuteSqlToDataSet("SELECT WeiXinId FROM [TireTreasureDB].[dbo].[TT_User] where LoginName='" + loginName + "'");

            if (result.Tables[0].Rows.Count > 0)
            {
                openId = result.Tables[0].Rows[0]["WeiXinId"].ToString();

                GetUData.Request_User_OpenId = openId;
                AppUserInfoBiz appUserInfoBiz = new AppUserInfoBiz();
                result = appUserInfoBiz.ExecuteSqlToDataSet("EXEC	[TireTreasureDB].[dbo].[proc_GetUserInfoByWeiXinId] '"+ openId + "'");
                if (result.Tables[0].Rows.Count > 0)
                {
                    ViewBag.nickName   = result.Tables[0].Rows[0]["Nickname"].ToString();
                    ViewBag.headImgUrl = result.Tables[0].Rows[0]["ImgeUrl"].ToString();


                    //TODO 判断搜索账号与搜索的状态关系 可分离出方法
                    RequestFriendsBiz requestFriendsBiz = new RequestFriendsBiz();
                    result = requestFriendsBiz.ExecuteSqlToDataSet("EXEC	[TireTreasureDB].[dbo].[proc_IsAlreadyFriend] '"+ GetUData.OpenId + "','" + GetUData.Request_User_OpenId + "'");
                    if (result.Tables[0].Rows.Count > 0)
                    {
                        ViewBag.states = ConstantList.ADD_FRIENDS_STATUS_SUCCESS;
                    }
                    result = requestFriendsBiz.ExecuteSqlToDataSet("EXEC [TireTreasureDB].[dbo].[proc_GetRequestUserId] '" + GetUData.OpenId + "'," + ConstantList.ADD_FRIENDS_STATUS_REQUESTING + "");
                    if (result.Tables[0].Rows.Count > 0)
                    {
                        ViewBag.states = ConstantList.ADD_FRIENDS_STATUS_REQUESTING;
                    }
                }
            }
            return(View());
        }