Esempio n. 1
0
        //添加好友请求
        public void addToFriend()
        {
            RequestFriendsBiz requestFriendsBiz = new RequestFriendsBiz();

            DataSet result = requestFriendsBiz.ExecuteSqlToDataSet("EXEC [TireTreasureDB].[dbo].[proc_GetRequestUserId] '" + GetUData.OpenId + "'," + ConstantList.ADD_FRIENDS_STATUS_REQUESTING + "");

            //TODO 重载页面前多次点击会生成多条数据 设置一个flag
            if (!(result.Tables[0].Rows.Count > 0))
            {
                UserBiz userBiz = new UserBiz();
                result = userBiz.ExecuteSqlToDataSet("SELECT UserId FROM [TireTreasureDB].[dbo].[TT_User] where WeiXinId='" + GetUData.OpenId + "'");
                if (result.Tables[0].Rows.Count > 0)
                {
                    RequestFriends requestFriends = new RequestFriends();

                    Guid userId = (Guid)result.Tables[0].Rows[0][0];
                    requestFriends.UserId = userId;

                    result = userBiz.ExecuteSqlToDataSet("SELECT UserId FROM [TireTreasureDB].[dbo].[TT_User] where WeiXinId='" + GetUData.Request_User_OpenId + "'");

                    Guid toUserId = (Guid)result.Tables[0].Rows[0][0];
                    requestFriends.ToUserId  = toUserId;
                    requestFriends.States    = ConstantList.ADD_FRIENDS_STATUS_REQUESTING;
                    requestFriends.AddTime   = DateTime.Now;
                    requestFriends.isDeleted = false;

                    //RequestFriendsBiz requestFriendsBiz = new RequestFriendsBiz();
                    requestFriendsBiz.Add(requestFriends);
                }
            }
            else
            {
                //TODO
            }
        }
Esempio n. 2
0
        //拒绝
        public ActionResult reject()
        {
            RequestFriendsBiz requestFriendsBiz = new RequestFriendsBiz();

            requestFriendsBiz.ExecuteSqlToDataSet("EXEC [TireTreasureDB].[dbo].[proc_UpdateRequestFriendsSates] '" + GetUData.OpenId + "'," + ConstantList.ADD_FRIENDS_STATUS_REJECT + "");
            return(RedirectToAction("Index", "Friends"));
        }
Esempio n. 3
0
        //请求好友列表
        public ActionResult requestFriendList()
        {
            RequestFriendsBiz requestFriendsBiz = new RequestFriendsBiz();
            DataSet           result            = requestFriendsBiz.ExecuteSqlToDataSet("EXEC [dbo].[proc_GetUserInfoBy_v_RequestFriends] '" + GetUData.OpenId + "'");

            if (result.Tables[0].Rows.Count > 0)
            {
                List <Dictionary <string, string> > list = new List <Dictionary <string, string> >();
                for (int count = 0; count < result.Tables[0].Rows.Count; count++)
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    dictionary.Add("Nickname", result.Tables[0].Rows[count]["Nickname"].ToString());
                    dictionary.Add("ImgeUrl", result.Tables[0].Rows[count]["ImgeUrl"].ToString());
                    dictionary.Add("States", result.Tables[0].Rows[count]["States"].ToString());
                    list.Add(dictionary);
                }
                ViewBag.messageList = list;
            }
            return(View());
        }
Esempio n. 4
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"));
        }
Esempio n. 5
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());
        }