コード例 #1
0
ファイル: ChatController.cs プロジェクト: 503945930/baoxin
 public JsonResult LoadOnlineUser()
 {
     List<Users> users = new List<Users>();
     UsersBLL bll = new UsersBLL();
     users=bll.LoadOnlineUser();
     return this.Json(users,JsonRequestBehavior.AllowGet);
 }
コード例 #2
0
ファイル: AccountController.cs プロジェクト: 503945930/baoxin
 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);
 }
コード例 #3
0
ファイル: ChatController.cs プロジェクト: 503945930/baoxin
        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);
        }
コード例 #4
0
ファイル: Global.asax.cs プロジェクト: 503945930/baoxin
 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);
     }
 }
コード例 #5
0
ファイル: AdminController.cs プロジェクト: 503945930/baoxin
        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;
            }
        }
コード例 #6
0
ファイル: AccountController.cs プロジェクト: 503945930/baoxin
        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;
            }
        }
コード例 #7
0
ファイル: HomeController.cs プロジェクト: 503945930/baoxin
        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("");
        }
コード例 #8
0
ファイル: HomeController.cs プロジェクト: 503945930/baoxin
 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("");
 }
コード例 #9
0
ファイル: AccountController.cs プロジェクト: 503945930/baoxin
        /// <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("/");
        }
コード例 #10
0
ファイル: BaseWebController.cs プロジェクト: 503945930/baoxin
        /// <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中获取用户的基本信息
        }