コード例 #1
0
        public ActionResult DeactivateUser(string StaffID)
        {
            string userkey   = ConfigurationManager.AppSettings["userkey"];
            string uid       = ConfigurationManager.AppSettings["uid"];
            string LoginUser = (string)Session["LoginSAPID"];

            try
            {
                Employer.Employer employer = new Employer.Employer();
                var updateStatus           = employer.AdministerInternalUser(StaffID, LoginUser, "1", "3", userkey, uid);
                var updateDetails          = updateStatus.Split('~');

                if (updateDetails[0] != "01")
                {
                    TempData["smessage"] = updateDetails[1];
                    return(RedirectToAction("Index"));
                }
                else
                {
                    TempData["message"] = updateDetails[1];
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                LogError logerror = new LogError();
                logerror.ErrorLog("", LoginUser, "", "Admin/UpdateUsers", "Admin", "ActivateUser", "AdministerInternalUser Error", ex.Message.ToString(), 0);
                TempData["error"] = ex.Message.ToString();
                ViewBag.Error     = TempData["error"];
                return(RedirectToAction("Index"));
            }
        }
コード例 #2
0
        public ActionResult Create(AdminUsers admin)
        {
            string LoginUser = (string)Session["LoginSAPID"];

            try
            {
                string userkey = ConfigurationManager.AppSettings["userkey"];
                string uid     = ConfigurationManager.AppSettings["uid"];

                Employer.Employer employer = new Employer.Employer();

                var createAdmin = employer.AdministerInternalUser(admin.SAPID, LoginUser, admin.Role, "1", userkey, uid);

                var createStatus = createAdmin.Split('~');
                if (createStatus[0] != "01")
                {
                    TempData["error"] = createStatus[1];
                    ViewBag.Error     = TempData["error"];
                    return(RedirectToAction("Index"));
                }
                else
                {
                    TempData["error"] = createStatus[1];
                    ViewBag.Error     = TempData["error"];
                    return(View());
                }
            }
            catch (Exception ex)
            {
                LogError logerror = new LogError();
                logerror.ErrorLog("", LoginUser, "", "Admin/Create", "Admin", "Create", "AdministerInternalUser Error", ex.Message.ToString(), 0);
                TempData["error"] = ex.Message.ToString();
                ViewBag.Error     = TempData["error"];
                return(View());
            }
        }