Example #1
0
        public ActionResult UserInfo(Models.Users user)
        {
            GlobalMethod.log.Info(string.Format("{0}{1}提交报名信息", DateTime.Now.ToString(), user.Name));
            string Tel = WebCookieHelper.GetUserInfo(2);
            var    u   = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == user.Tel).FirstOrDefault();

            if (u == null)
            {
                user.Pwd        = SystemContext.Instance.GetPwd(Tel);
                user.CreateTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().UsersRepository.AddEntity(user);
            }
            else
            {
                if (user.ID == 0)
                {
                    user.ID = u.ID;
                }
                EnterRepository.GetRepositoryEnter().UsersRepository.EditEntity(user, new string[] { "Name", "Gender", "School", "ExamSchool", "ExamPlace", "ExceptRoomie", "Baks" });
            }
            if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
            {
                return(Content(""));
            }
            else
            {
                return(Content("提交成功"));
            }
        }
Example #2
0
 public ActionResult UserInfo(Models.Users user)
 {
     try
     {
         string Tel = WebCookieHelper.GetUserInfo(2);
         if (user.ID == 0)
         {
             user.Pwd = SystemContext.Instance.GetPwd(Tel);
             EnterRepository.GetRepositoryEnter().UsersRepository.AddEntity(user);
         }
         else
         {
             EnterRepository.GetRepositoryEnter().UsersRepository.EditEntity(user, new string[] { "Name", "Gender", "School", "PayPlace", "Template", "ExamSchool", "ExamPlace", "ExceptRoomie", "Baks" });
         }
         if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
         {
             return(Json(new { validate = "true", message = "提交成功" }));
         }
         else
         {
             return(Json(new { validate = "false", message = "提交失败" }));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(Json(new { validate = "false", message = "提交失败" }));
     }
 }
Example #3
0
        public ActionResult ExamPlace()
        {
            string Tel  = WebCookieHelper.GetUserInfo(2);
            string Name = WebCookieHelper.GetUserInfo(1);

            //未缓存手机号
            if (string.IsNullOrEmpty(Tel))
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == Tel).FirstOrDefault();

            if (result == null)
            {
                return(Redirect("/users/userinfo"));
            }
            return(View(result));
        }
Example #4
0
        public JsonResult CheckLogin()
        {
            var username = WebCookieHelper.GetUserInfo(1);
            var picture  = WebCookieHelper.GetUserInfo(4);

            if (string.IsNullOrEmpty(username))
            {
                return(Json(new
                {
                    state = "login",
                    username = "",
                    picture = ""
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                if (string.IsNullOrEmpty(picture))
                {
                    picture = SystemContext.Instance.GetDefaultImg();
                }
                return(Json(new
                {
                    state = "logined",
                    username = username,
                    picture = picture
                }, JsonRequestBehavior.AllowGet));
            }
        }
Example #5
0
        /// <summary>
        /// 酒店安排房间信息
        /// </summary>
        /// <returns></returns>
        public ActionResult RoomInfo()
        {
            string Tel = WebCookieHelper.GetUserInfo(2);

            if (string.IsNullOrEmpty(Tel))
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == Tel).FirstOrDefault();

            if (result == null)
            {
                return(Redirect("/users/userinfo"));
            }
            if (!string.IsNullOrEmpty(result.Hotel) &&
                !string.IsNullOrEmpty(result.Room))
            {
                var roomies = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Hotel == result.Hotel && m.Room == result.Room).ToList();
                if (roomies != null)
                {
                    ViewData["roomies"] = roomies;
                }
            }
            return(View(result));
        }
Example #6
0
        /// <summary>
        /// 酒店安排房间信息
        /// </summary>
        /// <returns></returns>
        public ActionResult RoomInfo()
        {
            string Tel = WebCookieHelper.GetUserInfo(2);

            if (string.IsNullOrEmpty(Tel))
            {
                return(Redirect("/sui/account/telephone"));
            }

            var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == Tel).FirstOrDefault();

            if (result == null)
            {
                return(Redirect("/sui/account/userinfo"));
            }
            if (!string.IsNullOrEmpty(result.Hotel) &&
                !string.IsNullOrEmpty(result.Room))
            {
                var roomies = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Hotel == result.Hotel && m.Room == result.Room).ToList();
                if (roomies != null)
                {
                    ViewData["roomies"] = roomies;
                }
            }
            return(View(result));
        }
Example #7
0
 public ActionResult Telephone(FormCollection fc)
 {
     try
     {
         string id = WebCookieHelper.GetUserInfo(0);
         if (string.IsNullOrEmpty(id))
         {
             return(Redirect("/weixin/account/"));
         }
         int nid    = int.Parse(id);
         var result = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.ID == nid).FirstOrDefault();
         if (result == null)
         {
             return(Redirect("/weixin/account/"));
         }
         result.Name = fc["Name"];
         result.Tel  = fc["Tel"];
         EnterRepository.GetRepositoryEnter().OAuthUserRepository.EditEntity(result, new string[] { "Name", "Tel" });
         if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
         {
             log.Info(string.Format("用户:{0}绑定手机号", result.NickName));
             WebCookieHelper.SetUserCookie(result.ID, result.Name, result.Tel, string.Empty, string.Empty, 7);
             return(Json(new { validate = "true", message = "绑定成功" }));
         }
         else
         {
             return(Json(new { validate = "false", message = "绑定失败" }));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(Json(new { validate = "false", message = "绑定失败" }));
     }
 }
Example #8
0
        public ActionResult ExamPlace(FormCollection fc)
        {
            string Tel = WebCookieHelper.GetUserInfo(2);

            if (string.IsNullOrEmpty(Tel))
            {
                return(Redirect("/member/login?returnurl=" + Request.Url));
            }
            var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == Tel).FirstOrDefault();

            if (result == null)
            {
                return(Redirect("/users/userinfo"));
            }
            string ddlSchool = fc["ddlSchool"];
            string Place     = fc["Place"];

            if (!string.IsNullOrEmpty(ddlSchool))
            {
                result.ExamPlace = ddlSchool;
            }
            else
            {
                result.ExamPlace = Place;
            }
            EnterRepository.GetRepositoryEnter().UsersRepository.EditEntity(result, new string[] { "ExamPlace" });
            if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
            {
                return(Content(""));
            }
            else
            {
                return(Content("提交失败"));
            }
        }
Example #9
0
        public ActionResult UserInfo(Models.Users user)
        {
            string Tel = WebCookieHelper.GetUserInfo(2);
            var userexist = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == user.Tel).FirstOrDefault();
            var invite = EnterRepository.GetRepositoryEnter().InviteRepository.LoadEntities(m => m.InviteTel == Tel && m.BeInviteTel == user.Tel).FirstOrDefault();
            if (invite == null && userexist == null)
            {
                user.Pwd = SystemContext.Instance.GetPwd(Tel);
                user.CreateTime = DateTime.Now;
                //考生不存在,并且未有邀请记录,则新增考生订房记录和邀请记录
                EnterRepository.GetRepositoryEnter().UsersRepository.AddEntity(user);
                if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
                {
                    invite = new Models.Invite();
                    invite.InviteTel = Tel;
                    invite.BeInviteTel = user.Tel;
                    invite.CreateTime = DateTime.Now;
                    EnterRepository.GetRepositoryEnter().InviteRepository.AddEntity(invite);
                    EnterRepository.GetRepositoryEnter().SaveChange();
                   
                }
                else
                {
                    return Content("邀请失败,创建考生预报名记录失败");
                }
            }
            else if (invite == null && userexist != null)
            {
                return Content("好友已经参加状元乐订房报名,无法重复邀请");
            }
            else if (invite != null && userexist != null)
            {
                //考生存在,并且有邀请记录,则允许修改考生订房信息
                EnterRepository.GetRepositoryEnter().UsersRepository.Get(m => m.ID == userexist.ID);
                user.ID = userexist.ID;
                EnterRepository.GetRepositoryEnter().UsersRepository.EditEntity(user, new string[] { "Name", "Gender", "School", "ExamSchool", "ExceptRoomie", "Baks" });
                if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                {
                    return Content("好友订房信息修改失败");
                }
            }
            else if (invite != null && userexist == null)
            {
                user.Pwd = SystemContext.Instance.GetPwd(Tel);
                user.CreateTime = DateTime.Now;
                //考生不存在,并且未有邀请记录,则新增考生订房记录和邀请记录
                EnterRepository.GetRepositoryEnter().UsersRepository.AddEntity(user);
                if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                {
                    return Content("邀请失败,创建考生预报名记录失败");
                }
            }
            GlobalMethod.log.Info(string.Format("{0}邀请{1}", WebCookieHelper.GetUserInfo(1), user.Name));
            return Content("");

        }
Example #10
0
 public ActionResult Index()
 {
     string tel = WebCookieHelper.GetUserInfo(2);
     DateTime startTime = DateTime.Now;
     var invites = EnterRepository.GetRepositoryEnter().InviteRepository.LoadEntities(m => m.InviteTel == tel).ToList();
     var users = new List<Models.Users>();
     foreach (var item in invites)
     {
         var user = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == item.BeInviteTel).FirstOrDefault();
         if (user != null)
             users.Add(user);
     }
     ViewBag.users = users;
     return View();
 }
Example #11
0
        public ActionResult Login(FormCollection form)
        {
            string name   = form["name"];
            string pwd    = form["pwd"];
            var    member = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.UserName == name ||
                                                                                               m.Tel == name || m.Mail == name).FirstOrDefault();

            if (member == null)
            {
                //从考试订房中获取考生资料
                var users = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == name).FirstOrDefault();
                if (users == null)
                {
                    return(Content("用户不存在"));
                }
                else
                {
                    //自动创建会员
                    member            = new Member();
                    member.CreateTime = DateTime.Now;
                    member.Tel        = users.Tel;
                    member.Picture    = SystemContext.Instance.GetDefaultImg();
                    member.Password   = string.IsNullOrEmpty(users.Pwd)? Utility.MD5Helper.MD5(SystemContext.Instance.DefaultPwd): Utility.MD5Helper.MD5(member.Password);
                    member.UserName   = users.Name + "_" + users.Sequences.ToString();
                    EnterRepository.GetRepositoryEnter().MemberRepository.AddEntity(member);
                    if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                    {
                        return(Content("用户不存在"));
                    }
                }
            }
            else if (Utility.MD5Helper.MD5(pwd) != member.Password)
            {
                return(Content("密码错误"));
            }
            WebCookieHelper.SetUserCookie(member.ID, member.UserName, member.Tel, "", member.Picture, 15);
            string tel      = WebCookieHelper.GetUserInfo(2);
            var    employee = EnterRepository.GetRepositoryEnter().EmployeeRepository.LoadEntities(m => m.Tel == tel).FirstOrDefault();

            if (employee != null)
            {
                WebCookieHelper.SetEmployeeCookie(employee.ID, employee.Name, employee.EmpNo, employee.Tel, 15);
            }
            return(Content(string.Empty));
        }
Example #12
0
        public ActionResult ExamPlace()
        {
            string Tel  = WebCookieHelper.GetUserInfo(2);
            string Name = WebCookieHelper.GetUserInfo(1);

            //未缓存手机号
            if (string.IsNullOrEmpty(Tel))
            {
                return(Redirect("/sui/account/telephone"));
            }
            var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == Tel).FirstOrDefault();

            if (result == null)
            {
                return(Redirect("/sui/account/userinfo"));
            }
            return(View(result));
        }
Example #13
0
        public ActionResult PersonalInfo()
        {
            int id     = WebCookieHelper.GetUserId(0);
            var member = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.ID == id).FirstOrDefault();

            if (member == null)
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var oAuthUser      = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.MemberID == id).FirstOrDefault();
            int blogsum        = EnterRepository.GetRepositoryEnter().BlogRepository.LoadEntities(m => m.MemberID == id).Count();
            int blogvideosum   = 0;
            int blogpicturesum = 0;

            EnterRepository.GetRepositoryEnter().BlogRepository.GetBlogs(null, id, SystemConst.CategoryCode.BlogVideo, null, 0, 0, out blogvideosum);
            EnterRepository.GetRepositoryEnter().BlogRepository.GetBlogs(null, id, SystemConst.CategoryCode.BlogPicture, null, 0, 0, out blogvideosum);

            if (oAuthUser != null)
            {
                ViewBag.FigureUrl = oAuthUser.Headimgurl;
            }
            string tel      = WebCookieHelper.GetUserInfo(2);
            var    employee = EnterRepository.GetRepositoryEnter().EmployeeRepository.LoadEntities(m => m.Tel == tel).FirstOrDefault();

            if (employee != null)
            {
                WebCookieHelper.SetEmployeeCookie(employee.ID, employee.Name, employee.EmpNo, employee.Tel, 15);
            }
            ViewBag.employee       = employee;
            ViewBag.blogsum        = blogsum;
            ViewBag.blogvideosum   = blogvideosum;
            ViewBag.blogpicturesum = blogpicturesum;
            GlobalMethod.log.Info(string.Format("{0}进入个人主页", member.UserName));
            return(View(member));
        }
Example #14
0
 public ActionResult ExamPlace(FormCollection fc)
 {
     try
     {
         string Tel = WebCookieHelper.GetUserInfo(2);
         if (string.IsNullOrEmpty(Tel))
         {
             return(Redirect("/weixin/account/telephone"));
         }
         var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == Tel).FirstOrDefault();
         if (result == null)
         {
             return(Redirect("/weixin/account/userinfo"));
         }
         string ddlSchool = fc["ddlSchool"];
         string Place     = fc["Place"];
         if (!string.IsNullOrEmpty(ddlSchool))
         {
             result.ExamPlace = ddlSchool;
         }
         else
         {
             result.ExamPlace = Place;
         }
         EnterRepository.GetRepositoryEnter().UsersRepository.EditEntity(result, new string[] { "ExamPlace" });
         if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
         {
             return(Json(new { validate = "true", message = "考点提交成功" }));
         }
         else
         {
             return(Json(new { validate = "false", message = "考点提交失败" }));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(Json(new { validate = "false", message = "考点提交失败" }));
     }
 }
Example #15
0
        public ActionResult LuckyRoller()
        {
            int id     = WebCookieHelper.GetUserId(0);
            var member = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.ID == id).FirstOrDefault();

            if (member == null)
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var invites = EnterRepository.GetRepositoryEnter().InviteRepository.LoadEntities(m => m.InviteTel == member.Tel).ToList();

            if (invites != null && invites.Count > 0)
            {
                List <string> lstBeinvite = new List <string>();
                foreach (var item in invites)
                {
                    lstBeinvite.Add(item.BeInviteTel);
                }
                //获取邀请名额
                var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => lstBeinvite.Contains(m.Tel) && m.EmployeeID != 0).ToList();
                ViewBag.users = result;
            }
            var lottery = EnterRepository.GetRepositoryEnter().LotteryRepository.LoadEntities(m => m.Tel == member.Tel).FirstOrDefault();

            ViewBag.lottery = lottery;
            string szName = WebCookieHelper.GetUserInfo(1);

            GlobalMethod.log.Info(string.Format("{0}进入幸运大转盘抽奖", szName));
            return(View());
        }
Example #16
0
        public ActionResult UserInfo(Models.Users user)
        {
            string Tel = WebCookieHelper.GetUserInfo(2);

            if (user.ID == 0)
            {
                user.Pwd = SystemContext.Instance.GetPwd(Tel);
                EnterRepository.GetRepositoryEnter().UsersRepository.AddEntity(user);
            }
            else
            {
                EnterRepository.GetRepositoryEnter().UsersRepository.EditEntity(user, new string[] { "Name", "Gender", "School", "ExamSchool", "ExamPlace", "ExceptRoomie", "Baks" });
            }
            if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
            {
                return(Content(""));
            }
            else
            {
                return(Content("提交成功"));
            }
        }
Example #17
0
 public ActionResult SaveAdvice(Models.Advice advice)
 {
     try
     {
         advice.Name       = WebCookieHelper.GetUserInfo(1);
         advice.Contact    = WebCookieHelper.GetUserInfo(2);
         advice.CreateTime = DateTime.Now;
         EnterRepository.GetRepositoryEnter().AdviceRepository.AddEntity(advice);
         if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
         {
             return(Json(new { validate = "true", message = "提交成功" }));
         }
         else
         {
             return(Json(new { validate = "false", message = "提交失败" }));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(Json(new { validate = "false", message = "提交失败" }));
     }
 }
Example #18
0
        public ActionResult Save()
        {
            var    prize = Request.Form["prize"];
            string tel   = WebCookieHelper.GetUserInfo(2);
            string name  = WebCookieHelper.GetUserInfo(1);

            var    lottery = EnterRepository.GetRepositoryEnter().LotteryRepository.LoadEntities(m => m.Tel == tel).FirstOrDefault();
            string result  = string.Empty;
            var    invites = EnterRepository.GetRepositoryEnter().InviteRepository.LoadEntities(m => m.InviteTel == tel).ToList();

            if (invites == null || invites.Count <= 0)
            {
                result = "您未成功邀请任何人,无法参与抽奖!";
                return(Content(result));
            }
            if (invites != null && invites.Count > 0)
            {
                List <string> lstBeinvite = new List <string>();
                foreach (var item in invites)
                {
                    lstBeinvite.Add(item.BeInviteTel);
                }
                //获取邀请名额
                var users = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => lstBeinvite.Contains(m.Tel) && m.EmployeeID != 0).ToList();
                if (users == null || users.Count <= 0)
                {
                    result = "您未成功邀请任何人,无法参与抽奖!";
                    return(Content(result));
                }
                if (lottery != null)
                {
                    var prizes = lottery.Prize.Split('、');
                    if (users.Count <= prizes.Length)
                    {
                        result = "抽奖次数限制,本次抽奖无效!";
                        return(Content(result));
                    }
                }
            }
            if (lottery == null)
            {
                lottery            = new Models.Lottery();
                lottery.Tel        = tel;
                lottery.Prize      = prize;
                lottery.CreateTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().LotteryRepository.AddEntity(lottery);
                if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                {
                    result = "抽奖结果保存失败";
                    return(Content(result));
                }
            }
            else
            {
                lottery.Prize      = string.IsNullOrEmpty(lottery.Prize)?prize: lottery.Prize + "、" + prize;
                lottery.CreateTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().LotteryRepository.EditEntity(lottery, new string[] { "Prize", "CreateTime" });
                if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                {
                    result = "抽奖结果保存失败";
                    return(Content(result));
                }
            }
            return(Content(result));
        }