public ActionResult Edit(Guid?ID) { NR.Models.NRMembership CU; if (ID == null) { CU = new NR.Models.NRMembership { Association = reposetory.GetAssociation(CurrentProfile.AssociationID), SignupDate = DateTime.Now, Type = PersonType.Active, Person = new Person { Country = Country.DK } }; //CU.Person = new Person(); } else { CU = reposetory.GetMembership((Guid)ID); if (CU == null) { return(HttpNotFound()); } } return(View(CU)); }
public ActionResult Index() { if (CurrentProfile.AssociationID == Guid.Empty) { return(RedirectToAction("Index", "Home", new { Area = "" })); } ThePlanModel Plan = new ThePlanModel { Plan = reposetory.GetAssociationPlan(CurrentProfile.AssociationID), association = reposetory.GetAssociation(CurrentProfile.AssociationID) }; return(View(Plan)); }
// GET: Admin/News public ActionResult Index() { List <NewsAdminViewModel> result = new List <NewsAdminViewModel>(); foreach (News N in reposetory.GetNews()) { NewsAdminViewModel tmp = new NewsAdminViewModel { News = N }; if (N.Source == LevelType.Local) { tmp.Association = reposetory.GetAssociation(N.SourceLink); tmp.SourceName = tmp.Association == null ? "-" : tmp.Association.Name; } if (N.Source == LevelType.Network) { tmp.Network = reposetory.GetNetwork(N.SourceLink); tmp.SourceName = tmp.Network == null ? "-" : tmp.Network.NetworkName; } result.Add(tmp); } return(View(result)); }
public ActionResult CreatePerson(Guid ID) { Lead dbLead = new Lead(); dbLead = reposetory.GetLead(ID); if (dbLead == null) { return(RedirectToAction("Index")); } NRMembership CU = new NR.Models.NRMembership { Association = reposetory.GetAssociation(CurrentProfile.AssociationID), SignupDate = DateTime.Now, Type = PersonType.Active, Person = new Person { Country = Country.DK, FirstName = dbLead.FirstName, FamilyName = dbLead.FamilyName, Address = dbLead.Address, Zip = dbLead.Zip, City = dbLead.City, Phone = dbLead.Phone, Mobile = dbLead.Mobile } }; return(View("../People/edit", CU)); }
public ActionResult Index(Guid?id) { Association association; if (id == null) { association = reposetory.GetAssociation(CurrentProfile.AssociationID); } else { association = reposetory.GetAssociation((Guid)id); } if (association == null) { return(HttpNotFound()); } ViewBag.JsonLocations = new JavaScriptSerializer().Serialize( from l in association.Locations.Where(L => L.Active == true) where (l.Lat != 0 & l.Lng != 0 & l.Active) select new { Name = l.Name, Lat = l.latstring, Lng = l.lngstring }); return(View(association)); }
public ActionResult _ResetLocalPage() { Association association = reposetory.GetAssociation(CurrentProfile.AssociationID); if (association.PageAbout == null) { association.PageAbout = new Content(); } association.PageAbout.Title = DefaultForening.PageContentAboutTitle; association.PageAbout.Body = DefaultForening.PageContentAbout; if (association.PagePress == null) { association.PagePress = new Content(); } association.PagePress.Title = DefaultForening.PageContentPressTitle; association.PagePress.Body = DefaultForening.PageContentPress; if (association.PageSponsor == null) { association.PageSponsor = new Content(); } association.PageSponsor.Title = DefaultForening.PageContentSponsorTitle; association.PageSponsor.Body = DefaultForening.PageContentSponsor; if (association.PageLink == null) { association.PageLink = new Content(); } association.PageLink.Title = DefaultForening.PageContentLinkTitle; association.PageLink.Body = DefaultForening.PageContentLink; association.UsePressPage = false; association.UseSponsorPage = false; association.UseLinksPage = false; reposetory.SaveAssociation(association); return(RedirectToAction("EditAssociationpages")); }
public ActionResult SimulateAssociation(Guid Id) { Association association = reposetory.GetAssociation(Id); if (association != null) { TempData["AdminAssociationID"] = association.AssociationID; } return(RedirectToAction("Index")); }
public ActionResult RetriveLogin(string email, string mobile, string returnUrl) { ViewBag.ReturnUrl = returnUrl; List <Person> Persons = reposetory.GetPeople(email, mobile); LogFile.Write(string.Format("Retrive login {0}/{1}", email, mobile)); if (Persons != null) { foreach (Person P in Persons) { if (!WebSecurity.Login(P.UserName, P.Password, persistCookie: false)) { if (WebSecurity.ResetPassword(WebSecurity.GeneratePasswordResetToken(P.UserName), P.Password)) { } } else { WebSecurity.Logout(); } if (!String.IsNullOrWhiteSpace(P.Email)) { var mail = new ForgotLoginEmail { To = P.Email, UserName = P.UserName, Password = P.Password }; try { mail.Send(); } catch (Exception Ex) { LogFile.Write(Ex, "Send Mail Retrive Login"); } } if (!String.IsNullOrWhiteSpace(P.Mobile) && P.CurrentAssociation != Guid.Empty) { Association association = reposetory.GetAssociation(P.CurrentAssociation); #if DUMMYTEXT ITextMessage SMSGateway = TextServiceProviderFactory.GetTextServiceProviderrInstance("NR.Infrastructure.DummyTextGateway", association == null ? null : association.TextServiceProviderUserName, association == null ? null : association.TextServiceProviderPassword); #else ITextMessage SMSGateway = TextServiceProviderFactory.GetTextServiceProviderrInstance(association.TextServiceProvider, association == null ? null : association.TextServiceProviderUserName, association == null ? null : association.TextServiceProviderPassword); #endif SMSGateway.FromText = General.SystemTextMessagesFrom; SMSGateway.Message = String.Format(General.SystemTextMessagesForgetLogin, P.UserName, P.Password); SMSGateway.Recipient = new List <Person> { P }; reposetory.NewTextMessage(SMSGateway, association.AssociationID); SMSGateway.HandShakeUrl = Url.Action("TextXStatus", "Account", new { ID = SMSGateway.TextId }, "http"); if (SMSGateway.Send()) { } ; } } } ViewBag.LoginRetrived = true; return(View("Login")); }
public ActionResult Edit(Person person, string RadioGender, string Action, Guid Attach) { Person CU = new Person(); if (person.PersonID != Guid.Empty) { CU = reposetory.GetPersonComplete(person.PersonID); if (CU == null) { return(RedirectToAction("Index")); } } //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.Note = person.Note; CU.SeniorInstructor = person.SeniorInstructor; if (String.IsNullOrWhiteSpace(CU.Password)) { CU.Password = String.Empty.GeneratePassword(); } List <AssociationListModel> tmp = reposetory.GetAssociationList(); //.RemoveAll(item => CU.Memberships.ToList().Exists(p => p.Association.AssociationID == item.AssociationID)); ViewBag.Attach = new SelectList(tmp, "AssociationID", "Name"); if (Action == "add" && Attach != Guid.Empty) { Association association = reposetory.GetAssociation(Attach); if (association != null && association.Status == AssociationStatus.Active) { NR.Models.NRMembership Mem = new NR.Models.NRMembership { Association = association, SignupDate = DateTime.Now, Type = PersonType.Active }; CU.Memberships.Add(Mem); reposetory.SavePerson(CU); ModelState.Clear(); } } if (Action == "Edit" & ModelState.IsValid) { var refresh = person.PersonID == Guid.Empty; reposetory.SavePerson(CU); if (refresh) { //WebSecurity.IsConfirmed if (!WebSecurity.IsConfirmed(CU.UserName)) { WebSecurity.CreateAccount(CU.UserName, CU.Password); } if (!string.IsNullOrWhiteSpace(CU.Email)) { var mail = new WelcomeMailEmail { To = CU.Email, UserName = CU.UserName, Password = CU.Password }; mail.Send(); } } ViewBag.FormSucces = true; ModelState.Clear(); } if (CU.Memberships == null) { CU.Memberships = new List <NR.Models.NRMembership>(); } if (CU.Causes == null) { CU.Causes = new List <CausePartisipant>(); } return(View(CU)); }
// GET: KeyBox public ActionResult Index() { Association association = reposetory.GetAssociation(CurrentProfile.AssociationID); return(View(association)); }