Esempio n. 1
0
 public JsonResult LoadOnlineUser()
 {
     List<Users> users = new List<Users>();
     UsersBLL bll = new UsersBLL();
     users=bll.LoadOnlineUser();
     return this.Json(users,JsonRequestBehavior.AllowGet);
 }
Esempio n. 2
0
 public ActionResult GetUserFriends()
 {
     var result = new TResult<List<UsersEntity>>();
     UsersBLL userBLL = new UsersBLL();
     if (CurrentUser!=null)
     {
         var friendList = userBLL.GetFriendUsersListByUserId(null,  CurrentUser.Id);
         result = friendList;
     }
     return Json(result);
 }
Esempio n. 3
0
        public ActionResult Room(string id)
        {
            var model = new TResult<UsersEntity>();

            if (!string.Empty.Equals(id))
            {
                Guid userId = new Guid(id);
                UsersBLL bll = new UsersBLL();
                model = bll.GetUsersEntityByID(userId, null);
            }

            return View(model);
        }
Esempio n. 4
0
 protected void Session_End(object sender, EventArgs e)
 {
     var user = new UsersEntity();
     if (Session["User"] != null) {
         user = Session["User"] as UsersEntity;
     }
     UsersBLL uBll = new UsersBLL();
     if (user != null)
     {
         user.IsOnline = 0;
         uBll.Update(user, null);
     }
 }
Esempio n. 5
0
        public ActionResult DoLogin(LoginModel users)
        {
            try
            {
                var loginName = WebHelper.GetFormString("loginName", string.Empty);
                var password = WebHelper.GetFormString("password", string.Empty);
                UsersBLL bll = new UsersBLL();
                var user = new UsersEntity();
                //首先判断是邮箱还是电话:
                if (ValidateHelper.IsEmail(loginName))
                {
                    user = bll.GetUsersEntityByEmail1(loginName, null).TData;
                }
                else
                {
                    if (ValidateHelper.IsPhone(loginName))
                    {
                        user = bll.GetUsersEntityByMobile1(loginName, null).TData;
                    }
                    else
                    {
                        return Content("<script>alert('请输入正确的邮箱或者电话号码!!');location.href = '/shop/admin/login';</script>");

                    }
                }
                if (user != null && user.Password.Equals(SecurityUtil.HashPassword(password)))
                {
                    //统一存cookie
                    ShopUtils.SetUserCookie(user, 2);
                    Session["User"] = user;
                    user.IsOnline = 1;
                    bll.Update(user, null);
                    return Content("<script>location.href = '/shop/admin/pass';</script>");

                }

                else
                    return Content("<script>alert('用户名或密码不正确!!');location.href = '/shop/admin/login';</script>");

            }
            catch (Exception ex)
            {
                return Content("<script>alert('登陆出错!!');location.href = '/shop/admin/login';</script>");

                throw;
            }
        }
Esempio n. 6
0
        public ActionResult Login()
        {
            try
            {
                var loginName = WebHelper.GetFormString("loginName", string.Empty);
                var password = WebHelper.GetFormString("password", string.Empty);
                UsersBLL bll = new UsersBLL();
                var user = new UsersEntity();
                //首先判断是邮箱还是电话:
                if (ValidateHelper.IsEmail(loginName))
                {
                    user = bll.GetUsersEntityByEmail(loginName, null).TData;
                }
                else
                {
                    if (ValidateHelper.IsPhone(loginName))
                    {
                        user = bll.GetUsersEntityByMobile(loginName, null).TData;
                    }
                    else
                    {
                        return AjaxResult("valicationErr", "请输入正确的邮箱或者电话号码!!", false);
                    }
                }
                if (user != null && user.Password.Equals(SecurityUtil.HashPassword(password)))
                {
                    //统一存cookie
                    ShopUtils.SetUserCookie(user, 2);
                    Session["User"] = user;
                    user.IsOnline = 1;
                    bll.Update(user,null);

                    return AjaxResult("success", "登录成功!!", false);
                }

                else
                    return AjaxResult("error", "用户名或密码不正确!!", false);
            }
            catch (Exception ex)
            {
                return AjaxResult("error", ex.ToString(), false);
                throw;
            }
        }
Esempio n. 7
0
        public ContentResult DelOneSpeeInfo(string id)
        {
            if (Session["User"] != null)
            {
                var User = Session["User"] as UsersEntity;
                UsersBLL ubill = new UsersBLL();
                if (User != null)
                {

                    var quser = ubill.GetUserById(User.Id);

                    if (quser.isadmin == true)
                    {
                        Guid itemid = new Guid(id);
                        SpeechInfoBLL bll = new SpeechInfoBLL();
                        if (bll.Delete(itemid, User.Id))
                        {
                            return Content("操作成功");
                        }
                    }
                    else
                    {

                        if (BuildFactory.AppylyStroeFactory().QueryDateTime(User.Id) != null)
                        {
                            var dateTime = BuildFactory.AppylyStroeFactory().QueryDateTime(User.Id).DelTime;
                            DateTime dt1 = (DateTime)dateTime;

                            DateTime dt2 = DateTime.Now;
                            TimeSpan ts = dt2 - dt1;
                            if (ts.Days == 0 && ts.Hours == 0)
                            {
                                return Content("对不起,你在一个小时内不能再删其他用户的数据");
                            }
                            else
                            {

                                Guid itemid = new Guid(id);
                                SpeechInfoBLL bll = new SpeechInfoBLL();
                                if (bll.Delete(itemid, User.Id))
                                {
                                    return Content("操作成功");
                                }
                            }
                        }
                        else
                        {
                            Guid itemid = new Guid(id);
                            SpeechInfoBLL bll = new SpeechInfoBLL();
                            if (bll.Delete(itemid, User.Id))
                            {
                                return Content("操作成功");
                            }
                        }

                    }

                }
            }
            else
            {
                return Content("对不起,请先登陆了再删除");

            }

            return Content("");
        }
Esempio n. 8
0
 public ActionResult LoginOut(string uid)
 {
     var guid = new Guid(uid);
     UsersBLL uBll=new UsersBLL();
     var user = uBll.GetPartUserByUidAndPwd(guid);
     if (user != null)
     {
         user.IsOnline = 0;
         uBll.Update(user, null);
     }
     return Content("");
 }
Esempio n. 9
0
        /// <summary>
        /// 退出
        /// </summary>
        public ActionResult Logout()
        {
            if (!WorkContext.Uid.Equals(Guid.Empty))
            {
                WebHelper.DeleteCookie("bsp");
                if (Session["User"] != null)
                {
                    UsersBLL userBLL = new UsersBLL();
                    var user = Session["User"] as UsersEntity;
                    if (user != null)
                    {
                        user.IsOnline = 0;
                        userBLL.Update(user, null);
                    }
                }
                Session["User"] = null;
                Session.Abandon();

                //  Sessions.RemoverSession(WorkContext.Sid);
                //   OnlineUsers.DeleteOnlineUserBySid(WorkContext.Sid);
            }
            return Redirect("/");
        }
Esempio n. 10
0
        /// <summary>
        /// 说明:初始化调用构造函数后可能不可用的数据。
        /// </summary>
        /// <param name="requestContext"></param>
        protected override void Initialize(RequestContext requestContext)
        {
            base.Initialize(requestContext);
            SpeechInfoBLL bll = new SpeechInfoBLL();
            citys = bll.GetCitys();

            WorkContext.IsHttpAjax = WebHelper.IsAjax();
            WorkContext.Url = WebHelper.GetUrl();
            WorkContext.UrlReferrer = WebHelper.GetUrlReferrer();
            WorkContext.IP = WebHelper.GetIP();
            // WebHelper.GetIP();

            if (string.IsNullOrWhiteSpace(WorkContext.IP) || WorkContext.IP == "127.0.0.1")
            {
                WorkContext.CityName = "重庆市";
            }
            else
            {
                //测试地址搜索#region 测试地址搜索
                IPScaner objScan = new IPScaner();
                string ip = Request.UserHostAddress.ToString();
                objScan.DataPath = Server.MapPath("/App_data/qqwry.Dat");
                objScan.IP = WorkContext.IP;
                //"113.200.29.90";
                string addre = objScan.IPLocation();
                int IndexofA = addre.IndexOf("省") + 1;
                WorkContext.CityName = addre.Substring(IndexofA);
            }
            UsersEntity userInfo = new UsersEntity();
            Guid uid = ShopUtils.GetUidCookie();
            //获得保存在cookie中的密码
            string encryptPwd = ShopUtils.GetCookiePassword();
            UsersBLL userBll = new UsersBLL();
            if (Session["User"] != null)
            {
                CurrentUser = Session["User"] as UsersEntity;
                userInfo = CurrentUser;
            }
            else
            {

                userInfo = userBll.GetPartUserByUidAndPwd(uid);
              //  requestContext.HttpContext.Response.Write("<script>alert('登录超时!');window.location.reload();</script>");
            }

            if (userInfo != null && !Guid.Empty.Equals(userInfo.Id))
            {
                WorkContext.Uid = userInfo.Id;
                WorkContext.Password = userInfo.Password;
                WorkContext.UserEmail = userInfo.Email;
                WorkContext.NickName = string.IsNullOrWhiteSpace(userInfo.NickName) ? userInfo.Email : userInfo.NickName;
            }

            //从cookie中获取用户的基本信息
        }