예제 #1
0
        public ActionResult FacultyAdmin(FacultyAdminViewModel model)
        {
            //Check for the user logged in
            if (Session["USERINFO"] == null)
            {
                return RedirectToAction("Logon", "Account", new { ReturnUrl = Request.Url.PathAndQuery });
            }

            var acctype = Session["ACCTYPE"].ToString() ?? "";

            var facultyAdminViewModel = new FacultyAdminViewModel();

            //  Check for role
            if (acctype == "A")
            {
                facultyAdminViewModel.FacultyAdminEmail = objBaseMainConfigAdmin.IwebConfigAdmin.FacultyAdminEmailAddress;

                facultyAdminViewModel.FacultyAdminEmail = objBaseMainConfigAdmin.IwebConfigAdmin.FacultySecondaryEmailAddress;

            }

            var myObject = new { LOGIN = UvUsername };

            //Call the store service method to get the list of stores
            var lstStores = StoreServices.GetStore(StoreNumber, "TRUE",
                                                          UvUsername, UvPassword,
                                                          DbType, UvAddress, UvAccount, CacheTime, CacheTime,
                                                          Strd3PortNumber, UseEncryption, Strd3PortNumber);

            var lstStoreList = new List<SelectListItem>();

            foreach (var s in lstStores)
            {
                var item = new SelectListItem { Text = s.Name, Value = s.Id };
                lstStoreList.Add(item);
            }

            ViewData["lstStoreList"] = lstStoreList;

            return View(facultyAdminViewModel);
        }
예제 #2
0
        /// <summary>
        /// Update the email address of the admin
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult JsonUpdateAdmin(FacultyAdminViewModel model)
        {
            if (!HasAdminPrivilege())
            {
                return RedirectToAction("Logon", "Account", new { ReturnUrl = Request.Url.PathAndQuery });
            }
            var errMsg = "";
            try
            {    //Checking for null
                if (!(string.IsNullOrEmpty(model.FacultyAdminEmail) && string.IsNullOrEmpty(model.FacultySecondaryEmail)))
                {
                    objBaseMainConfigAdmin.IwebConfigAdmin.FacultyAdminEmailAddress = model.FacultyAdminEmail;

                    objBaseMainConfigAdmin.IwebConfigAdmin.FacultySecondaryEmailAddress = model.FacultySecondaryEmail;

                    objBaseMainConfigAdmin.SaveValues();

                    errMsg = "Successfully updated";
                }
                else
                {
                    errMsg = "Values can't be empty";
                }
            }
            catch (Exception x)
            {
                errMsg = x.Message;
            }
            return Json(new { errMsg = errMsg });
        }