Exemplo n.º 1
0
        //
        // GET: /Friends/

        public ActionResult Index()
        {
            //判断是否已经注册
            if (!isRegister())
            {
                string controller = RouteData.Values["controller"].ToString();
                return(Redirect(redirctUrl(controller)));
            }

            FriendsBiz friendsBiz = new FriendsBiz();
            DataSet    result     = friendsBiz.ExecuteSqlToDataSet("EXEC	[TireTreasureDB].[dbo].[proc_GetUserInfoBy_v_FriendsList] '"+ 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("AddTime", result.Tables[0].Rows[count]["AddTime"].ToString());
                    list.Add(dictionary);
                }
                ViewBag.friendList = list;
            }

            return(View());
        }
Exemplo n.º 2
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"));
        }