public ActionResult MyInfo(RegistrationVM model)
        {
            model.Registration.StateID = model.States.Where(s => s.Selected).FirstOrDefault().Value;
            model.Registration.UserToken = myCoalUser.UserToken;

            if (!ModelState.IsValid)
                return PartialView("MyInfo", model);

            try
            {

                // the system owner can update anybody's registration, but anyone else can only update their own
                // therefore only lookup a user by id when the owner is performing the task to prevent a user from maliciously
                // chaning their RegistrationId before posting the form thereby updating someone else's data
                RegistrationDO data;
                if (myCoalUser.GetInstance().IsInRole("owner"))
                    data = RegistrationBLL.GetRegistration(model.Registration.RegistrationID);
                else
                    data = RegistrationBLL.GetRegistrationByUserToken(myCoalUser.UserToken);

                // restrict the update to the visible elements on the form
                data.Address1 = model.Registration.Address1;
                data.City = model.Registration.City;
                data.CompanyName = model.Registration.CompanyName;
                data.CountryCode = model.Registration.CountryCode;
                data.Email = model.Registration.Email;
                data.FirstName = model.Registration.FirstName;
                data.LastName = model.Registration.LastName;
                data.Phone = model.Registration.Phone;
                data.PhoneExtension = model.Registration.PhoneExtension;
                data.RegistrationDescription = model.Registration.RegistrationDescription;
                data.StateID = model.Registration.StateID;
                data.Title = model.Registration.Title;
                data.Zipcode = model.Registration.Zipcode;

                RegistrationBLL.Save(data);

                // refresh the cookie values
                myCoalUser.ResetProfileCookie();

                // return ok to let the javascript clien tknow the update went well
                AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.OK, "User profile information was saved");
                return Json(result);
            }
            catch (Exception ex)
            {
                AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.ERROR, ex.Message);
                return Json(result);
            }
        }
示例#2
0
        public SecurityVM(UserProfileBO profile)
        {
            Registration = new RegistrationVM() { Registration = profile.Registration };
            myPermitRegistrations = profile.PermitRegistration;

            myCoalUser user = myCoalUser.GetInstance();

            // owners and permit coordinators can see a user's permit registrations
            if (user.IsInRole(CoalRoles.Owner) || user.IsInRole(CoalRoles.PermitCoordinator))
            {
                AllPermits = PermitBLL.GetPermits();
            }

            // owners can see user's system roles
            if (user.IsInRole(CoalRoles.Owner))
            {
                IsOwner = profile.Roles.Contains(CoalRoles.Owner);
                IsManagement = profile.Roles.Contains(CoalRoles.Management);
                IsReviewStaff = profile.Roles.Contains(CoalRoles.ReviewStaff);
                IsPermitCoordinator = profile.Roles.Contains(CoalRoles.PermitCoordinator);
                IsReadOnly = profile.Roles.Contains(CoalRoles.Reader);
            }
        }
 public ActionResult MyInfo(int RegistrationId)
 {
     RegistrationDO reg = RegistrationBLL.GetRegistration(RegistrationId);
     RegistrationVM model = new RegistrationVM() { Registration = reg };
     return PartialView(model);
 }
        public ActionResult Register(RegistrationVM model)
        {
            model.Registration.StateID = model.States.Where(s => s.Selected).FirstOrDefault().Value;
            model.Registration.UserToken = myCoalUser.UserToken;

            if (!ModelState.IsValid)
                return View(model);

            try
            {
                // strip out any non-numeric characters
                Regex re = new Regex(@"[^\d]");
                model.Registration.Phone = re.Replace(model.Registration.Phone, "");

                // request registration
                RegistrationBLL.Save(model.Registration);

                // show confirmation screen
                return RedirectToAction("RegistrationReceived", "Account");
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return View(model);
            }
        }
        public ActionResult Register()
        {
            // don't allow users to register twice
            if (RegistrationBLL.IsUserRegistered(myCoalUser.UserToken))
            {
                //myCoalUser.GetInstance().
                return RedirectToAction("RegistrationReceived");
            }

            ViewBag.Message = "Register";
            RegistrationDO reg = new RegistrationDO() { CountryCode = "1" };
            RegistrationVM model = new RegistrationVM() { Registration = reg };
            return View(model);
        }
示例#6
0
 public SecurityVM()
 {
     Registration = new RegistrationVM();
 }
        public ActionResult Register()
        {
            // don't allow users to register twice
            if (RegistrationBLL.IsUserRegistered(myCoalUser.UserToken))
                return RedirectToAction("RegistrationReceived");

            EPassPrincipal ePassUser = (EPassPrincipal)System.Web.HttpContext.Current.User;
            ViewBag.Message = "Register";
            RegistrationDO reg = new RegistrationDO() { CountryCode = "1", FirstName = ePassUser.Attributes.FirstName, LastName = ePassUser.Attributes.LastName, Email = ePassUser.Attributes.EMail };
            RegistrationVM model = new RegistrationVM() { Registration = reg };
            return View(model);
        }