コード例 #1
0
ファイル: SliderController.cs プロジェクト: coder-TuAnh/Exo
 // GET: /Administrator/Slider/
 public ActionResult Index()
 {
     LoadData();
     ViewBag.Messages = CommentController.Messages(TempData["Messages"]);
     ViewBag.Title    = "Sliders";
     return(View());
 }
コード例 #2
0
        //
        // GET: /Administrator/TabArticle/

        public ActionResult Index()
        {
            ViewBag.Messages = CommentController.Messages(TempData["Messages"]);
            ViewBag.Title    = "TabArticle";
            LoadData();
            return(View());
        }
コード例 #3
0
        //
        // GET: /Administrator/ControlPanel/
        public ActionResult Index()
        {
            var    db                 = new MyDbDataContext();
            string cookieClient       = Request.Cookies["name_client"].Value;
            string deCodecookieClient = CryptorEngine.Decrypt(cookieClient, true);
            string userName           = deCodecookieClient.Substring(0, deCodecookieClient.IndexOf("||"));

            ViewBag.Users    = db.Users.FirstOrDefault(a => a.UserName == userName);
            ViewBag.Title    = "Administrator";
            ViewBag.Messages = CommentController.Messages(TempData["Messages"]);
            return(View());
        }
コード例 #4
0
        public ActionResult Index()
        {
            if (Request.Cookies["name_client"] != null)
            {
                return(RedirectToAction("Index", "ControlPanel"));
            }
            ViewBag.Messages     = CommentController.Messages(TempData["Messages"]);
            ViewBag.ListLanguage = CommentController.ListLanguage().Select(a => new SelectListItem
            {
                Value = a.ID,
                Text  = a.Name
            }).ToList();

            return(View());
        }
コード例 #5
0
        //
        // GET: /Administrator/BookTour/
        public ActionResult Index()
        {
            using (var db = new MyDbDataContext())
            {
                string cookieClient       = Request.Cookies["name_client"].Value;
                string deCodecookieClient = CryptorEngine.Decrypt(cookieClient, true);
                string userName           = deCodecookieClient.Substring(0, deCodecookieClient.IndexOf("||"));
                var    user = db.Users.FirstOrDefault(a => a.UserName == userName);
                if (user.UserContent == true)
                {
                    int        cout       = 0;
                    HttpCookie langCookie = Request.Cookies["lang_client"];
                    while (langCookie != null)
                    {
                        langCookie.Expires = DateTime.Now.AddDays(-30);
                        HttpContext.Response.Cookies.Add(langCookie);
                        cout++;
                        if (cout == 10)
                        {
                            break;
                        }
                    }
                    cout = 0;
                    HttpCookie nameCookie = Request.Cookies["name_client"];
                    while (nameCookie != null)
                    {
                        nameCookie.Expires = DateTime.Now.AddDays(-30);
                        HttpContext.Response.Cookies.Add(nameCookie);
                        cout++;
                        if (cout == 10)
                        {
                            break;
                        }
                    }
                    CurrentSession.ClearAll();
                    return(Redirect("http://swallowtravel.com/admin"));
                }
            }
            ViewBag.Messages = CommentController.Messages(TempData["Messages"]);
            ViewBag.Title    = "Book tour";

            return(View());
        }
コード例 #6
0
 public ActionResult Select(string id)
 {
     using (var db = new MyDbDataContext())
     {
         Language lang = db.Languages.FirstOrDefault(b => b.ID == id);
         if (lang != null)
         {
             HttpCookie langCookie = Request.Cookies["lang_client"];
             langCookie.Value   = lang.ID;
             langCookie.Expires = DateTime.Now.AddDays(30);
             HttpContext.Response.Cookies.Add(langCookie);
             TempData["Messages"] = "Thay đổi ngôn ngữ thành công";
         }
         else
         {
             TempData["Messages"] = "Đổi ngôn ngữ không thành công, ngôn ngữ không tồn tại";
             ViewBag.Messages     = CommentController.Messages(TempData["Messages"]);
         }
         return(RedirectToAction("Index", "ControlPanel"));
     }
 }
コード例 #7
0
        public ActionResult Index()
        {
            //var db = new MyDbDataContext();

            //string cookieClient = Request.Cookies["name_client"].Value;
            //string deCodecookieClient = CryptorEngine.Decrypt(cookieClient, true);
            //string userName = deCodecookieClient.Substring(0, deCodecookieClient.IndexOf("||"));
            //var user = db.Users.FirstOrDefault(a => a.UserName == userName);
            //if (user.UserContent == true)
            //{
            //    int cout = 0;
            //    HttpCookie langCookie = Request.Cookies["lang_client"];
            //    while (langCookie != null)
            //    {
            //        langCookie.Expires = DateTime.Now.AddDays(-30);
            //        HttpContext.Response.Cookies.Add(langCookie);
            //        cout++;
            //        if (cout == 10)
            //            break;
            //    }
            //    cout = 0;
            //    HttpCookie nameCookie = Request.Cookies["name_client"];
            //    while (nameCookie != null)
            //    {
            //        nameCookie.Expires = DateTime.Now.AddDays(-30);
            //        HttpContext.Response.Cookies.Add(nameCookie);
            //        cout++;
            //        if (cout == 10)
            //            break;
            //    }
            //    CurrentSession.ClearAll();
            //    return View();
            //}
            LoadData();
            ViewBag.Messages = CommentController.Messages(TempData["Messages"]);
            ViewBag.Title    = "Promotion";
            return(View());
        }
コード例 #8
0
ファイル: MenuController.cs プロジェクト: coder-TuAnh/Exo
 public ActionResult MainMenu()
 {
     ViewBag.Messages     = CommentController.Messages(TempData["Messages"]);
     ViewBag.MenuLocation = GetLocaltion(SystemMenuLocation.MainMenu);
     return(View("Index"));
 }
コード例 #9
0
        public ActionResult Index(LoginModel model)
        {
            Random random;

            if (TempData["Count"] != null && int.Parse(TempData["Count"].ToString()) >= 5)
            {
                TempData.Keep("Count");
                if (string.IsNullOrEmpty(model.Captcha))
                {
                    ViewBag.ShowCaptcha = true;
                    ModelState.AddModelError("Captcha", "Vui lòng nhập captcha");
                }
                else
                {
                    if (model.Captcha != Session["Captcha"].ToString())
                    {
                        ViewBag.ShowCaptcha = true;
                        ModelState.AddModelError("Captcha", "Mã captcha không đúng");
                    }
                }
            }
            if (string.IsNullOrEmpty(model.LanguageID))
            {
                ModelState.AddModelError("LanguageID", "Vui lòng chọn ngôn ngữ");
            }
            if (ModelState.IsValid)
            {
                int checklogin = CheckLogin.CheckUserLogin(model.UserName, model.Password, model.LanguageID);
                switch (checklogin)
                {
                case 1:

                    //Đăng nhập thành công
                    string     cookieClient       = model.UserName + "||";
                    string     decodeCookieClient = CryptorEngine.Encrypt(cookieClient, true);
                    HttpCookie userCookie         = new HttpCookie("name_client");
                    userCookie.Value   = decodeCookieClient;
                    userCookie.Expires = DateTime.Now.AddDays(30);
                    HttpContext.Response.Cookies.Add(userCookie);

                    HttpCookie langCookie = new HttpCookie("lang_client");
                    langCookie.Value   = model.LanguageID;
                    langCookie.Expires = DateTime.Now.AddDays(30);
                    HttpContext.Response.Cookies.Add(langCookie);

                    TempData["Count"]    = 0;
                    TempData["Messages"] = "Đăng nhập thành công";
                    return(RedirectToAction("Index", "ControlPanel"));

                case 2:
                    TempData["Messages"] = "Tài khoản đã bị khóa";
                    return(RedirectToAction("Index"));

                case 3:
                    if (TempData["Count"] == null)
                    {
                        TempData["Count"] = 1;
                        TempData.Keep("Count");
                    }
                    else
                    {
                        TempData["Count"] = int.Parse(TempData["Count"].ToString()) + 1;
                        TempData.Keep("Count");
                    }
                    if (int.Parse(TempData["Count"].ToString()) >= 5)
                    {
                        random = new Random();
                        int iNumber = random.Next(10000, 99999);
                        Session["Captcha"] = iNumber.ToString();

                        ViewBag.ShowCaptcha = true;
                        ViewBag.Message     = CommentController.Messages(TempData["Message"]);
                        return(View());
                    }
                    ViewBag.ListLanguage = CommentController.ListLanguage().Select(a => new SelectListItem
                    {
                        Value = a.ID,
                        Text  = a.Name
                    }).ToList();
                    ViewBag.Messages = "Tên đăng nhập và mật khẩu không đúng";
                    return(View(model));
                }
            }
            return(View());
        }
コード例 #10
0
ファイル: CompanyController.cs プロジェクト: coder-TuAnh/Exo
        //
        // GET: /Administrator/Company/

        // GET: /Administrator/Article/
        public ActionResult Index()
        {
            ViewBag.Messages = CommentController.Messages(TempData["Messages"]);
            ViewBag.Title    = "Company";
            return(View());
        }
コード例 #11
0
ファイル: RoomController.cs プロジェクト: coder-TuAnh/Exo
 // GET: /Administrator/Room/
 public ActionResult Index()
 {
     ViewBag.Messages = CommentController.Messages(TempData["Messages"]);
     ViewBag.Title    = "Trang quảng lý phòng";
     return(View());
 }