Exemple #1
0
        //登录 获取用户信息从数据库中验证
        public ActionResult Login(User user)
        {
            UserSql us = new UserSql();

            if (us.judgeUser(user))
            {
                User u = us.getUserInfo(user);
                //应该验证是否封号

                if (u.User_State == 0)
                {
                    //return 封号view;
                    return(View("IdBlocked"));
                }

                Session["LoginState"] = "已登录";
                //获取用户的所有信息.  存放session
                Session["user"] = (User)u;
                return(RedirectToAction("Index", "FFTXIndex"));
            }
            else
            {
                return(View("LoginFail"));
            }
        }
Exemple #2
0
        public ActionResult changeHeadImg(HttpPostedFileBase file)
        {
            if (file == null)
            {
                return(RedirectToAction("Index", "Manage", new { headImgState = 0 }));
            }
            else
            {
                //根据用户名创建文件夹保存照片
                string user_id = ((User)Session["user"]).User_Id;
                string path    = Request.MapPath("~/Content/headimg/");
                string hz      = file.FileName.Substring(file.FileName.LastIndexOf("."));

                if (Directory.Exists(path) == false)//如果不存在就创建file文件夹
                {
                    Directory.CreateDirectory(path);
                }
                string fname = user_id + hz;
                file.SaveAs(path + fname);//保存文件
                //更新数据库
                User u = new User();
                u.User_Id = user_id;
                UserSql us = new UserSql();
                u = us.getUserInfo(u);
                u.User_HeadImg = "/Content/headimg/" + fname;
                us.changeHeadImg(u);
                //更新数据库

                return(RedirectToAction("Index", "Manage", new { headImgState = 1 }));
            }
        }
Exemple #3
0
        //好友相册页面
        public ActionResult albumPage()
        {
            string uid = ((User)Session["user"]).User_Id;
            //获取好友个人信息
            string fid    = Request.QueryString["friend_id"];
            User   friend = new User();

            friend.User_Id = fid;
            UserSql usl = new UserSql();

            friend         = usl.getUserInfo(friend);
            ViewBag.friend = friend;
            //获取好友相册
            AlbumSql asql = new AlbumSql();
            //获取好友相册
            Album album = new Album();

            try
            {
                album.User_Id = friend.User_Id;
            }
            catch (NullReferenceException)
            {
                return(RedirectToAction("index", "Login"));
            }
            List <Album> list = asql.getFriendAlbumInfo(album);

            ViewBag.list = list;
            return(View());
        }
Exemple #4
0
        public ActionResult searchReason()
        {
            string uid = Request.QueryString["user_id"];
            //获取被封用户详细信息
            User u = new User();

            u.User_Id = uid;
            UserSql us = new UserSql();

            u = us.getUserInfo(u);
            ViewBag.blockUser = u;

            //获取封号原因
            AdminOperate ao  = new AdminOperate();
            AdminSql     asl = new AdminSql();

            ao = asl.getAdminOperateByuid(u);
            ViewBag.operate = ao;

            return(View());
        }