Ejemplo n.º 1
0
        public ActionResult ChangeCode()
        {
            if (Session["acc"] == null)
            {
                return(View("index"));
            }

            THC_Library.Error error;
            var acc  = Session["acc"].ToString();
            var old  = Request.Form["txt_old"];
            var new1 = Request.Form["txt_new1"];
            var new2 = Request.Form["txt_new2"];

            Models.SystemControl systemCtl = new Models.SystemControl();
            systemCtl.changePassword(acc, old, new1, new2, out error);

            string retJson;

            if (error != null)
            {
                retJson = Newtonsoft.Json.JsonConvert.SerializeObject(error);
            }
            else
            {
                retJson = "{ \"RESULT\" : 1 }";
            }
            return(Json(retJson, "application/json", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 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.SystemControl  systemCtl = new Models.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 THC_Library.Language.LanguageBase();
                lanSet.CurrentZone = THC_Library.Language.LanguageBase.CURRENT_LANGUAGE;
                ViewData["lan"]    = lanSet;

                if (userTable == null)
                {
                    //Models.MyEvent myEvent = new Models.MyEvent();
                    //System.Data.DataTable eventsTable = myEvent.getMyEventList(out error);

                    if (error != null)
                    {
                        ViewBag.Error = error.ErrorMessage;
                        return(View("../Backend/Error"));
                    }
                    else
                    {
                        //ViewBag.Data = eventsTable;
                        return(View("../Backend/EventActivities"));
                    }
                }
                else
                {
                    ViewBag.ADMIN = true;
                    return(View("Preview", userTable));
                }
            }
        }
Ejemplo n.º 3
0
        public JsonResult DeleteUser()
        {
            THC_Library.Error error;
            var user = Request.Form["account"];

            Models.SystemControl systemCtl = new Models.SystemControl();
            int iExcuteCount = systemCtl.deleteUser(user, out error);

            string retJson;

            if (error != null)
            {
                retJson = Newtonsoft.Json.JsonConvert.SerializeObject(error);
            }
            else
            {
                retJson = string.Format("{{ \"RESULT\" : {0} }}", iExcuteCount);
            }
            return(Json(retJson, "application/json", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        public JsonResult UserInfo()
        {
            THC_Library.Error error;
            var user = Request.Form["account"];

            Models.SystemControl  systemCtl = new Models.SystemControl();
            System.Data.DataTable userTable = systemCtl.getUserInfo(user, out error);

            string retJson;

            if (error != null)
            {
                retJson = Newtonsoft.Json.JsonConvert.SerializeObject(error);
            }
            else
            {
                retJson = Newtonsoft.Json.JsonConvert.SerializeObject(userTable);
            }
            return(Json(retJson, "application/json", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        public JsonResult Logout()
        {
            THC_Library.Error error;
            string            strAccount = Request.Form["user"];

            Models.SystemControl systemCtl = new Models.SystemControl();
            systemCtl.clearLoginTime(strAccount, out error);

            string retJson;

            if (error != null)
            {
                retJson = Newtonsoft.Json.JsonConvert.SerializeObject(error);
            }
            else
            {
                Session["acc"] = null;
                retJson        = "{ \"RESULT\": 1}";
            }
            return(Json(retJson, "application/json", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        public JsonResult NewUser()
        {
            THC_Library.Error error;
            var user        = Request.Form["txt_acc"];
            var name        = Request.Form["txt_name"];
            var access_code = Request.Form["txt_pass"];

            Models.SystemControl systemCtl = new Models.SystemControl();
            int iExcuteCount = systemCtl.addNewAccount(user, name, access_code, out error);

            string retJson;

            if (error != null)
            {
                retJson = Newtonsoft.Json.JsonConvert.SerializeObject(error);
            }
            else
            {
                retJson = string.Format("{{ \"RESULT\" : {0} }}", iExcuteCount);
            }
            return(Json(retJson, "application/json", JsonRequestBehavior.AllowGet));
        }