Example #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);
            }
        }
Example #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);
            }
        }
Example #3
0
        private WebUser GetWebInformation()
        {
            var studentNo = Session[SessionKeyStudentNo];

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

            if (userInfo != null)
            {
                ISettingsService settingsService = new SettingsService();
                userInfo.WelcomeMsg        = settingsService.GetWelcomeMsgText();
                userInfo.RoleReportsRights = webUserService.GetRoleRights("Student");
                userInfo.LoginMsg          = settingsService.GetLoginMsgText();
                userInfo.TitleMsg          = settingsService.GetTitleMsg();
                userInfo.LogoFileName      = settingsService.GetLogoFileName();
                userInfo.EmailOrStudentId  = (Int16)settingsService.GetForgetUsernameSetting();
                // Set Logo file Path
                //var path = ConfigurationManager.AppSettings["logoPath"];

                //path = Path.Combine(path, userInfo.LogoFileName);

                //ViewData["LogoFilePath"] = HeaderControl.imagesPath;
            }
            else
            {
                logger.Warn("User Info is null. ID is: " + studentNo);
            }
            return(userInfo);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         IWebUserService webUserService = new WebUserService();
         enabledReportsList = webUserService.GetRoleRights(Session["DD_Role"].ToString());
     }
     catch (SqlException sqlEx)
     {
         throw new Exception(EnumUtils.GetStringValue(ErrorMessage.UserDefinedMessage), sqlEx);
     }
     catch (Exception ex)
     {
         throw new Exception(EnumUtils.GetStringValue(ErrorMessage.UserDefinedMessage), ex);
     }
 }
Example #5
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));
        }