public ActionResult _Message(Guid ID) { Message Message = reposetory.GetMessage(ID, CurrentProfile.PersonID); CurrentProfile.Clear(); return(PartialView(Message)); }
public ActionResult NotificationLink(Guid Id) { Notification Not = reposetory.NotificationRead(Id, CurrentProfile.PersonID); if (Not != null) { CurrentProfile.Clear(); switch (Not.Type) { case NotificationType.Folder: return(RedirectToAction("FolderPlanning", "Planning", new { id = Not.Link, Area = "" })); break; case NotificationType.Team: return(RedirectToAction("View", "Planning", new { id = Not.Link, Area = "" })); break; case NotificationType.Person: return(RedirectToAction("View", "People", new { id = Not.Link, Area = "" })); break; case NotificationType.NewVersion: return(RedirectToAction("About", "Home", new { Area = "" })); break; case NotificationType.Association: return(RedirectToAction("Index", "Association", new { id = Not.Link, Area = "" })); break; case NotificationType.Content: return(RedirectToAction("Content", "Home", new { id = Not.Link, Area = "" })); break; case NotificationType.AssociationNote: return(RedirectToAction("View", "Association", new { id = Not.Link, Area = "Admin" })); break; } } return(RedirectToAction("MyNotifications", "Notification", new { id = Not.NotificationID, Area = "" })); }
//[ValidateAntiForgeryToken] public ActionResult Login(LoginModel model, string returnUrl) { if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe)) { LogFile.Write(model.UserName.ToUpper() + " loged in < < <"); CurrentProfile.Clear(); if (!string.IsNullOrWhiteSpace(returnUrl) && Url.IsLocalUrl(returnUrl)) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Home")); } } // If we got this far, something failed, redisplay form LogFile.Write(model.UserName.ToUpper() + " failed login < < <"); ModelState.AddModelError("", General.LoginError); return(View(model)); }
public ActionResult Setup(Person CU) { Person dbPerson = reposetory.GetPersonComplete(CurrentProfile.PersonID); if (CU == null | dbPerson.PersonID != CurrentProfile.PersonID) { return(HttpNotFound()); } dbPerson.ListLines = CU.ListLines < 10 ? 10 : CU.ListLines; if (dbPerson.CurrentAssociation != CU.CurrentAssociation) { dbPerson.CurrentAssociation = CU.CurrentAssociation; } reposetory.SavePerson(dbPerson); CurrentProfile.Clear(); ModelState.Clear(); ViewBag.FormSucces = true; var Associations = dbPerson.Memberships.Select(d => new SelectListItem { Value = d.AssociationID.ToString(), Text = d.Association.Name }).ToList(); if (Associations == null) { Associations = new List <SelectListItem>(); Associations.Insert(0, new SelectListItem { Value = Guid.Empty.ToString(), Text = General.DropDownEmpty }); } if (Associations != null) { ViewBag.Associations = Associations; } return(View(CU)); }
public ActionResult Access(AccessModel access, string Action) { AccessModel dbAccess = reposetory.GetAccess(access.AssociationID); access.SelectPersons = dbAccess.SelectPersons; if (Action == "add") { if (access.Form == null) { access.Form = new List <PersonAccess>(); } if (!access.Form.Where(f => f.FunctionID == access.AddPerson).Any()) { access.Form.Add(new PersonAccess { FunctionID = access.AddPerson, }); } } foreach (PersonAccess p in access.Form) { p.FullName = access.SelectPersons.Find(ps => ps.FunctionID == p.FunctionID).FullName; } access.SelectPersons.RemoveAll(item => access.Form.Exists(p => p.FunctionID == item.FunctionID)); if (Action == "Access" & ModelState.IsValid) { reposetory.SaveAccess(access.Form); ViewBag.FormSucces = true; CurrentProfile.Clear(); } return(View(access)); }
// // POST: /Account/LogOff //[HttpPost] //[ValidateAntiForgeryToken] public ActionResult LogOff() { WebSecurity.Logout(); CurrentProfile.Clear(); return(RedirectToLocal("~/")); }
public ActionResult EditProfile(Person person, string RadioGender, string Action) { Person CU = new Person(); if (person.PersonID != Guid.Empty) { CU = reposetory.GetPersonComplete(person.PersonID); if (CU == null) { return(HttpNotFound()); } } //Check for a uniq username against database if (person.PersonID == Guid.Empty || person.UserName != CU.UserName) { if (String.IsNullOrWhiteSpace(person.UserName) | !reposetory.IsUserNameUniqe(person.UserName)) { string SuggestedUserName = person.UserName; if (person.PersonID == Guid.Empty) { reposetory.GenerateUniqueUserName(person); ModelState.SetModelValue("UserName", new ValueProviderResult(null, string.Empty, CultureInfo.InvariantCulture)); if (!String.IsNullOrWhiteSpace(SuggestedUserName)) { ModelState.AddModelError("UserName", string.Format(DomainStrings.UserNameNotUniqueSuggestion, SuggestedUserName)); } } else { person.UserName = CU.UserName; //ModelState.Clear(); ModelState.SetModelValue("UserName", new ValueProviderResult(null, string.Empty, CultureInfo.InvariantCulture)); ModelState.AddModelError("UserName", string.Format(DomainStrings.UserNameNotUnique, SuggestedUserName)); } } } if (RadioGender == "M") { person.Gender = Gender.Man; } if (RadioGender == "F") { person.Gender = Gender.Woman; } person.Trim(); if (CU.MailUndeliverable && ( CU.FirstName != person.FirstName | CU.FamilyName != person.FamilyName | CU.Address != person.Address | CU.City != person.City | CU.Zip != person.Zip )) { CU.MailUndeliverable = false; CU.MailUndeliverableDate = null; } CU.UserName = person.UserName; CU.FirstName = person.FirstName; CU.FamilyName = person.FamilyName; CU.Address = person.Address; CU.City = person.City; CU.Zip = person.Zip; CU.Email = person.Email; CU.Country = person.Country; CU.Mobile = person.Mobile; CU.Phone = person.Phone; //CU.BasicTrainingDate = person.BasicTrainingDate; CU.BirthDate = person.BirthDate; CU.EmailNewsLetter = person.EmailNewsLetter; CU.PrintNewslettet = person.PrintNewslettet; CU.Gender = person.Gender; CU.ProfileInfo = person.ProfileInfo; //CU.Note = person.Note; //CU.SeniorInstructor = person.SeniorInstructor; if (ModelState.IsValid) { var refresh = person.PersonID == Guid.Empty; reposetory.SavePerson(CU); ViewBag.FormSucces = true; CurrentProfile.Clear(); //if (refresh) return RedirectToAction("Edit", new { ID = CU.PersonID.ToString() }); } //if (CU.Memberships == null) CU.Memberships = new List<NRMembership>(); return(View(CU)); }