Beispiel #1
0
        public ActionResult UserControl()
        {
            if (Session["acc"] == null)
            {
                return(View("index"));
            }

            var lanSet = new Language.User_Lan();

            lanSet.CurrentZone = THC_Library.Language.LanguageBase.CURRENT_LANGUAGE;
            ViewData["lan"]    = lanSet;
            ViewBag.ACCOUNT    = Session["acc"].ToString();
            return(View("Users"));
        }
Beispiel #2
0
        public ActionResult EnterControl()
        {
            THC_Library.Error error;
            string            strAccount = Request.Form["user"];
            string            strPwd     = Request.Form["pass"];

            if (string.IsNullOrEmpty(strAccount))
            {
                ViewBag.ERROR_MESSAGE = "請輸入帳號";
                return(View("Index"));
            }
            if (string.IsNullOrEmpty(strPwd))
            {
                ViewBag.ERROR_MESSAGE = "請輸入密碼";
                return(View("Index"));
            }

            Models.Register.SystemControl systemCtl = new Models.Register.SystemControl();
            System.Data.DataTable         userTable = systemCtl.enterVerify(strAccount, strPwd, out error);

            if (error != null)
            {
                ViewBag.ORG_ACCOUNT   = strAccount;
                ViewBag.ERROR_MESSAGE = error.ErrorMessage;
                return(View("Index"));
            }
            else
            {
                Session["acc"]  = strAccount;
                ViewBag.ACCOUNT = Session["acc"].ToString();

                var lanSet = new Language.User_Lan();
                lanSet.CurrentZone = THC_Library.Language.LanguageBase.CURRENT_LANGUAGE;
                ViewData["lan"]    = lanSet;

                if (userTable == null)
                {
                    ViewBag.ADMIN = false;
                    return(View("Users", userTable));
                }
                else
                {
                    ViewBag.ADMIN = true;
                    return(View("Users", userTable));
                }
            }
        }