示例#1
0
        public ActionResult ModifyReportRights(string enableReports)
        {
            try
            {
                var studentNo = Session[SessionKeyStudentNo];

                IWebUserService webUserService = new WebUserService();
                webUserService.UpdateReportsRight(enableReports, "Student");

                // Get Admin information ...
                WebUser userInfo = webUserService.GetUserInfo(int.Parse(studentNo.ToString()));
                userInfo.WelcomeMsg        = webUserService.GetWelcomeMsgText();
                userInfo.RoleReportsRights = webUserService.GetRoleRights("Student");
                userInfo.LoginMsg          = webUserService.GetLoginMsgText();

                ViewData["editOption"] = "NN";
                // Record is updated.
                ViewData["successMsg"] = "1";

                logger.Info("Report rights modification done successfully of Student No." + Session[SessionKeyStudentNo]);
                return(View("AdminSettings", userInfo));
            }
            catch (Exception ex)
            {
                logger.Error("Report rights modification failded of Student No." + Session[SessionKeyStudentNo], ex);

                // Redirect to error page
                Response.Redirect("Result/error");
                return(null);
            }
        }
示例#2
0
        public ActionResult ChangeLoginMsg(string txtChangeLoginMsg)
        {
            try
            {
                IWebUserService webUserService = new WebUserService();

                var studentNo = Session[SessionKeyStudentNo];

                webUserService.UpdateLoginMsg(txtChangeLoginMsg);

                // Get Admin information ...
                WebUser userInfo = webUserService.GetUserInfo(int.Parse(studentNo.ToString()));
                userInfo.WelcomeMsg        = webUserService.GetWelcomeMsgText();
                userInfo.RoleReportsRights = webUserService.GetRoleRights("Student");
                userInfo.LoginMsg          = webUserService.GetLoginMsgText();

                ViewData["editOption"] = "NN";
                // Record is updated.
                ViewData["successMsg"] = "1";

                logger.Info("Welcome message changed successfully of Student No." + Session[SessionKeyStudentNo]);
                return(View("AdminSettings", userInfo));
            }
            catch (Exception ex)
            {
                logger.Info("Welcome message not changed of Student No." + Session[SessionKeyStudentNo]);
                logger.Error(ex.Message);
                // Redirect to error page
                Response.Redirect("Result/error");
                return(null);
            }
        }
示例#3
0
        public ActionResult AdminSettings(string id)
        {
            var studentNo = Session[SessionKeyStudentNo];

            ViewData["editOption"] = id;

            // Record is not updated.
            ViewData["successMsg"] = "0";

            IWebUserService webUserService = new WebUserService();
            // Get Admin information ...
            WebUser userInfo = webUserService.GetUserInfo(int.Parse(studentNo.ToString()));

            userInfo.WelcomeMsg        = webUserService.GetWelcomeMsgText();
            userInfo.RoleReportsRights = webUserService.GetRoleRights("Student");
            userInfo.LoginMsg          = webUserService.GetLoginMsgText();

            return(View(userInfo));
        }
        public ActionResult Home()
        {
            try
            {
                IWebUserService webUserService = new WebUserService();

                var studentNo = Session[UserController.SessionKeyStudentNo];
                if (studentNo != null)
                {
                    string welcomeMsg = webUserService.GetWelcomeMsgText();
                    ViewData["WelcomeMsg"] = welcomeMsg;
                }

                return(View());
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                // Redirect to error page
                Response.Redirect("Result/error");
                return(null);
            }
        }