Ejemplo 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
            }
        }
        //获取推荐人ID
        public string getRecommendId()
        {
            UserBiz userBiz = new UserBiz();
            DataSet result  = userBiz.ExecuteSqlToDataSet("EXEC [TireTreasureDB].[dbo].[proc_GeRecommendIdByWeiXinId] '" + GetUData.OpenId + "'");

            return(result.Tables[0].Rows[0]["Id"].ToString());
        }
        private Guid getUserIdByRecommendId(string recommendId)
        {
            UserBiz userBiz = new UserBiz();
            DataSet result  = userBiz.ExecuteSqlToDataSet("EXEC [TireTreasureDB].[dbo].[proc_GetUserIdByRecommendId] '" + recommendId + "'");

            return((Guid)result.Tables[0].Rows[0]["UserId"]);
        }
Ejemplo n.º 4
0
        //获取当前用户ID
        public Guid getUserId()
        {
            UserBiz userBiz = new UserBiz();
            DataSet result  = userBiz.ExecuteSqlToDataSet("EXEC	[TireTreasureDB].[dbo].[proc_GetUserIdByWeiXinId] '" + GetUData.OpenId + "',null");

            return((Guid)result.Tables[0].Rows[0][0]);
        }
Ejemplo n.º 5
0
        //openId是否存在
        public static bool isOpenIdExist(string openId)
        {
            UserBiz userBiz = new UserBiz();
            DataSet result  = userBiz.ExecuteSqlToDataSet("EXEC   [TireTreasureDB].[dbo].[proc_IsOpenIdExist]'" + openId + "'");

            if (result.Tables[0].Rows.Count > 0)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        //检索手机号是否已注册
        private bool isPhoneNumberExist(String loginName)
        {
            UserBiz userBiz = new UserBiz();

            DataSet result = userBiz.ExecuteSqlToDataSet("EXEC [TireTreasureDB].[dbo].[proc_GetUserLoginNameByLoginName] '" + loginName + "'");

            if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 7
0
        public ActionResult searchUserInfo(string userAccount)
        {
            if (userAccount == null || userAccount == "" || !Util.isNumber(userAccount))
            {
                ViewData["IsShowAlert"] = true;
                ViewData["Alert"]       = "请输入手机号";
                return(View("index"));
            }

            UserBiz userBiz = new UserBiz();
            DataSet result  = userBiz.ExecuteSqlToDataSet("EXEC [TireTreasureDB].[dbo].[proc_GetUserLoginNameByLoginName] '" + userAccount + "'");

            if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0)
            {
                string loginName = result.Tables[0].Rows[0]["LoginName"].ToString();
                this.TempData["LonginName"] = loginName;
            }
            return(RedirectToAction("showUserInfo"));
        }
Ejemplo n.º 8
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());
        }