public ProfileMember CreateProfile(string address, string mobileTelephone1, string homeNumber, int memberId) { var memberRepository = RepositoryFactory.GetMemberRepository(); var profileMemberRepository = RepositoryFactory.GetProfileMemberRepository(); var member = memberRepository.GetEntityById(memberId); if (member == null) { return(null); } var profile = new ProfileMember { Address = address, HomeNumber = homeNumber, MobileTelephone1 = mobileTelephone1, MemberId = member.Id }; profileMemberRepository.Create(profile); try { UnitOfWork.PreSave(); } catch (Exception ex) { throw new ProfileMemberServiceException(ex); } return(profile); }
/// <summary> /// Adds the given family member to the configured tag (and tag member status). /// This logic was harvested dirctly from our custom UserConfirmation.ascx module /// which is a variant of Arena's UserConfirmation. /// </summary> /// <param name="fm">a family member</param> private void AddToTag(FamilyMember fm) { string text = base.CurrentUser.Identity.Name; if (text == string.Empty) { text = "Cccev.Core.FamilyRegistration.ascx"; } int profileId = -1; int lookupID = -1; int lookupID2 = -1; try { if (this.ProfileIDSetting.Contains("|")) { profileId = int.Parse(this.ProfileIDSetting.Split(new char[] { '|' })[1]); } else { profileId = int.Parse(this.ProfileIDSetting); } lookupID = int.Parse(this.SourceLUIDSetting); lookupID2 = int.Parse(this.StatusLUIDSetting); } catch (System.Exception inner2) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "If using a ProfileID setting for this module, then a valid numeric 'ProfileID', 'SourceLUID', and 'StatusLUID' setting must all be used!", inner2); } Profile profile = new Profile(profileId); Lookup lookup6 = new Lookup(lookupID); Lookup lookup7 = new Lookup(lookupID2); if (profile.ProfileID == -1 || lookup6.LookupID == -1 || lookup7.LookupID == -1) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "'ProfileID', 'SourceLUID', and 'StatusLUID' must all be valid IDs"); } ProfileMember profileMember = new ProfileMember(); profileMember.ProfileID = profile.ProfileID; profileMember.PersonID = fm.PersonID; profileMember.Source = lookup6; profileMember.Status = lookup7; profileMember.DatePending = DateTime.Now; profileMember.Save(text); if (profile.ProfileType == ProfileType.Serving) { ServingProfile servingProfile = new ServingProfile(profile.ProfileID); new ServingProfileMember(profileMember.ProfileID, profileMember.PersonID) { HoursPerWeek = servingProfile.DefaultHoursPerWeek }.Save(); } }
public static ProfileMember CreateProfileMember(EventProfile eventProfile, Person person) { ProfileMember member = new ProfileMember { ProfileID = eventProfile.ProfileID, PersonID = person.PersonID, Source = new Lookup(SystemLookup.TopicEntityType_EventTag), Status = new Lookup(SystemLookup.ServingActivityType_StatusChange) }; return(member); }
private void btnSave_Click(object sender, EventArgs e) { if (ValidateMemberFields(tbxName.Text, tbxSurname.Text, tbxPatronymic.Text, tbxPassport.Text)) { MessageBox.Show("Set all fields."); return; } var unitOfWork = new UnitOfWork(_context); var membershipService = new MembershipService(unitOfWork, unitOfWork); var profileMemberService = new ProfileMemberService(unitOfWork, unitOfWork); if (_isEditMode == false) { try { _member = membershipService.CreateMember(tbxName.Text, tbxSurname.Text, tbxPatronymic.Text, tbxPassport.Text, cmbxRole.SelectedItem.ToString()); _profile = profileMemberService.CreateProfile(tbxAddress.Text, tbxMobile.Text, tbxHome.Text, _member.Id); unitOfWork.Commit(); MessageBox.Show("Successfully added new employee"); Close(); } catch (Exception exception) { unitOfWork.Rollback(); } } else { try { MapToMember(); membershipService.UpdateMember(_member); membershipService.ChangeRole(_member.Id, cmbxRole.SelectedItem.ToString()); if (_profile == null) { _profile = profileMemberService.CreateProfile(tbxAddress.Text, tbxMobile.Text, tbxHome.Text, _member.Id); } else { profileMemberService.UpdateProfile(_profile); } } catch (Exception exception) { unitOfWork.Rollback(); } unitOfWork.Commit(); MessageBox.Show("Successfully edit employee"); Close(); } }
public void RemoveProfile(ProfileMember profile) { var profileMemberRepository = RepositoryFactory.GetProfileMemberRepository(); try { profileMemberRepository.Remove(profile); } catch (RepositoryException ex) { throw new ProfileMemberServiceException(ex); } }
public int DeleteByProfileIdAndEmployeeId(int profileId, int memberId) { int result = 0; using (AppDBContext dbContext = new AppDBContext(_config)) { ProfileMember record = dbContext.ProfileMember.Where(pd => pd.ProfileId == profileId && pd.MemberId == memberId).AsNoTracking().SingleOrDefault(); dbContext.Entry(record).State = EntityState.Deleted; result = dbContext.SaveChanges(); } return(result); }
public async Task <ProfileDto> CreateProfileMember(CreateProfileMember profileMemberCreated) { ProfileMember profileMember = new ProfileMember { ProfileId = profileMemberCreated.ProfileId, UserId = profileMemberCreated.UserId }; if (!MemberExists(profileMember.ProfileId, profileMember.UserId)) { _context.ProfileMembers.Add(profileMember); await _context.SaveChangesAsync(); } return(await GetProfile(profileMember.ProfileId)); }
private void SetValuesForControls(Member member, List <RoleMember> roles, ProfileMember profile) { tbxName.Text = member.Name; tbxSurname.Text = member.Surname; tbxPatronymic.Text = member.Patronymic; tbxPassport.Text = member.PassportData; cmbxRole.DataSource = roles; cmbxRole.Text = member.Role.Value; if (profile != null) { tbxAddress.Text = profile.Address; tbxHome.Text = profile.HomeNumber; tbxMobile.Text = profile.MobileTelephone1; } }
public int Add(ProfileMember record) { int result = 0; using (AppDBContext dbContext = new AppDBContext(_config)) { ProfileMember existrecord = dbContext.ProfileMember.Where(pd => pd.ProfileId == record.ProfileId && pd.MemberId == record.MemberId).FirstOrDefault(); if (existrecord == null) { dbContext.Entry(record).State = EntityState.Added; result = dbContext.SaveChanges(); } } return(result); }
void lvContacts_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; ProfileMember pm = (ProfileMember)dataItem.DataItem; PersonPhone hp = pm.Phones.FindByType(SystemLookup.PhoneType_Home); if (hp != null && hp.Number.Trim() != string.Empty) { Literal lCtcHome = (Literal)e.Item.FindControl("lCtcHome"); lCtcHome.Text = string.Format("<img src=\"images/home.gif\" style=\"cursor:pointer\" onclick=\"ClickToCall.MakeCall({0},'{1}','{2}','{3}');\"/>", PBXSystem.LookupID.ToString(), CurrentPerson.PeerChannel.Replace("'", "\\'"), hp.Number.Replace("'", "\\'"), CurrentPerson.FullName.Replace("'", "\\'")); } PersonPhone bp = pm.Phones.FindByType(SystemLookup.PhoneType_Business); if (bp != null && bp.Number.Trim() != string.Empty) { Literal lCtcWork = (Literal)e.Item.FindControl("lCtcWork"); lCtcWork.Text = string.Format("<img src=\"images/business.gif\" style=\"cursor:pointer\" onclick=\"ClickToCall.MakeCall({0},'{1}','{2}','{3}');\"/>", PBXSystem.LookupID.ToString(), CurrentPerson.PeerChannel.Replace("'", "\\'"), bp.Number.Replace("'", "\\'"), CurrentPerson.FullName.Replace("'", "\\'")); } PersonPhone cp = pm.Phones.FindByType(SystemLookup.PhoneType_Cell); if (cp != null && cp.Number.Trim() != string.Empty) { Literal lCtcCell = (Literal)e.Item.FindControl("lCtcCell"); lCtcCell.Text = string.Format("<img src=\"images/cell.gif\" style=\"cursor:pointer\" onclick=\"ClickToCall.MakeCall({0},'{1}','{2}','{3}');\"/>", PBXSystem.LookupID.ToString(), CurrentPerson.PeerChannel.Replace("'", "\\'"), cp.Number.Replace("'", "\\'"), CurrentPerson.FullName.Replace("'", "\\'")); } HyperLink hlName = (HyperLink)e.Item.FindControl("hlName"); hlName.NavigateUrl = string.Format("~/default.aspx?page={0}&guid={1}", PersonDetailPageIDSetting, pm.PersonGUID.ToString()); hlName.Text = string.Format("{0}, {1}", pm.LastName, pm.NickName); } }
public Contracts.ProfileMember GetProfileMember(int profileID, int personID) { ProfileMember member = new ProfileMember(profileID, personID); if (member.ProfileID == -1) { throw new Arena.Services.Exceptions.ResourceNotFoundException("Invalid profile ID"); } if (RestApi.ProfileOperationAllowed(ArenaContext.Current.Person.PersonID, member.ProfileID, OperationType.View) == false) { throw new Exception("Access denied."); } return(new Contracts.ProfileMember(member)); }
private void ViewEmployee_Load(object sender, System.EventArgs e) { var unitOfWork = new UnitOfWork(_context); var membershipService = new MembershipService(unitOfWork, unitOfWork); var profileMemberService = new ProfileMemberService(unitOfWork, unitOfWork); var meetingService = new MeetingService(unitOfWork, unitOfWork); _member = membershipService.GetMemberById(_memberId); _profile = profileMemberService.GetProfileByMemberId(_member.Id); SetDataToControls(); var commissions = membershipService.GetCommissionsOfMember(_member.Id); var meetings = meetingService.GetMeetingsOfMemberParticipate(_member.Id); dgvCommissions.DataSource = commissions; dgvMeetings.DataSource = meetings; unitOfWork.Commit(); }
private void AddChangeEmployee_Load(object sender, EventArgs e) { var unitOfWork = new UnitOfWork(_context); var membershipService = new MembershipService(unitOfWork, unitOfWork); var roles = membershipService.GetAllRoles(); if (_memberId != 0) { var profileMemberService = new ProfileMemberService(unitOfWork, unitOfWork); _member = membershipService.GetMemberById(_memberId); _profile = profileMemberService.GetProfileByMemberId(_member.Id); SetValuesForControls(_member, roles, _profile); unitOfWork.Commit(); } else { cmbxRole.DataSource = roles; unitOfWork.Commit(); } }
private void CreateAccount() { Arena.Security.Login login = new Arena.Security.Login(this.tbLoginID.Text); if (login.PersonID != -1) { int num = 0; string text = this.tbFirstName.Text.Substring(0, 1).ToLower() + this.tbLastName.Text.Trim().ToLower(); if (text != this.tbLoginID.Text.Trim().ToLower()) { login = new Arena.Security.Login(text); } while (login.PersonID != -1) { num++; login = new Arena.Security.Login(text + num.ToString()); } this.lblMessage.Text = "The Desired Login ID you selected is already in use in our system. Please select a different Login ID. Suggestion: <b>" + text + num.ToString() + "</b>"; this.pnlMessage.Visible = true; this.lblMessage.Visible = true; return; } Lookup lookup; try { lookup = new Lookup(int.Parse(this.MemberStatusIDSetting)); if (lookup.LookupID == -1) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "Member Status setting must be a valid Member Status Lookup value."); } } catch (System.Exception inner) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "Member Status setting must be a valid Member Status Lookup value.", inner); } int organizationID = base.CurrentPortal.OrganizationID; string text2 = base.CurrentUser.Identity.Name; if (text2 == string.Empty) { text2 = "NewAccount.ascx"; } Person person = new Person(); person.RecordStatus = RecordStatus.Pending; person.MemberStatus = lookup; if (ddlCampus.SelectedValue != string.Empty || this.CampusSetting != string.Empty) { // use the user set value if it exists, otherwise use the admin configured module setting string campusString = (ddlCampus.SelectedValue != string.Empty) ? ddlCampus.SelectedValue : this.CampusSetting; try { person.Campus = new Campus(int.Parse(campusString)); } catch { person.Campus = null; } } person.FirstName = this.tbFirstName.Text.Trim(); person.LastName = this.tbLastName.Text.Trim(); if (this.tbBirthDate.Text.Trim() != string.Empty) { try { person.BirthDate = DateTime.Parse(this.tbBirthDate.Text); } catch { } } if (this.ddlMaritalStatus.SelectedValue != string.Empty) { person.MaritalStatus = new Lookup(int.Parse(this.ddlMaritalStatus.SelectedValue)); } if (this.ddlGender.SelectedValue != string.Empty) { try { person.Gender = (Gender)Enum.Parse(typeof(Gender), this.ddlGender.SelectedValue); } catch { } } PersonAddress personAddress = new PersonAddress(); personAddress.Address = new Address(this.tbStreetAddress.Text.Trim(), string.Empty, this.tbCity.Text.Trim(), this.ddlState.SelectedValue, this.tbZipCode.Text.Trim(), false); personAddress.AddressType = new Lookup(SystemLookup.AddressType_Home); personAddress.Primary = true; person.Addresses.Add(personAddress); PersonPhone personPhone = new PersonPhone(); personPhone.Number = this.tbHomePhone.PhoneNumber.Trim(); personPhone.PhoneType = new Lookup(SystemLookup.PhoneType_Home); person.Phones.Add(personPhone); if (this.tbWorkPhone.PhoneNumber.Trim() != string.Empty) { personPhone = new PersonPhone(); personPhone.Number = this.tbWorkPhone.PhoneNumber.Trim(); personPhone.Extension = this.tbWorkPhone.Extension; personPhone.PhoneType = new Lookup(SystemLookup.PhoneType_Business); person.Phones.Add(personPhone); } if (this.tbCellPhone.PhoneNumber.Trim() != string.Empty) { personPhone = new PersonPhone(); personPhone.Number = this.tbCellPhone.PhoneNumber.Trim(); personPhone.PhoneType = new Lookup(SystemLookup.PhoneType_Cell); personPhone.SMSEnabled = this.cbSMS.Checked; person.Phones.Add(personPhone); } if (this.tbEmail.Text.Trim() != string.Empty) { PersonEmail personEmail = new PersonEmail(); personEmail.Active = true; personEmail.Email = this.tbEmail.Text.Trim(); person.Emails.Add(personEmail); } person.Save(organizationID, text2, false); person.SaveAddresses(organizationID, text2); person.SavePhones(organizationID, text2); person.SaveEmails(organizationID, text2); Family family = new Family(); family.OrganizationID = organizationID; family.FamilyName = this.tbLastName.Text.Trim() + " Family"; family.Save(text2); new FamilyMember(family.FamilyID, person.PersonID) { FamilyID = family.FamilyID, FamilyRole = new Lookup(SystemLookup.FamilyRole_Adult) }.Save(text2); Arena.Security.Login login2 = new Arena.Security.Login(); login2.PersonID = person.PersonID; login2.LoginID = this.tbLoginID.Text.Trim(); login2.Password = this.tbPassword.Text.Trim(); if (bool.Parse(this.EmailVerificationSetting)) { login2.Active = false; } else { login2.Active = true; } login2.Save(text2); login2 = new Arena.Security.Login(login2.LoginID); if (bool.Parse(this.EmailVerificationSetting)) { NewUserAccountEmailVerification newUserAccountEmailVerification = new NewUserAccountEmailVerification(); Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("##FirstName##", person.FirstName); dictionary.Add("##LastName##", person.LastName); dictionary.Add("##Birthdate##", person.BirthDate.ToShortDateString()); dictionary.Add("##MaritalStatus##", person.MaritalStatus.Value); dictionary.Add("##Gender##", person.Gender.ToString()); dictionary.Add("##StreetAddress##", (person.Addresses.Count > 0) ? person.Addresses[0].Address.StreetLine1 : "N/A"); dictionary.Add("##City##", (person.Addresses.Count > 0) ? person.Addresses[0].Address.City : "N/A"); dictionary.Add("##State##", (person.Addresses.Count > 0) ? person.Addresses[0].Address.State : "N/A"); dictionary.Add("##ZipCode##", (person.Addresses.Count > 0) ? person.Addresses[0].Address.PostalCode : "N/A"); dictionary.Add("##HomePhone##", this.tbHomePhone.PhoneNumber); dictionary.Add("##WorkPhone##", this.tbWorkPhone.PhoneNumber); dictionary.Add("##CellPhone##", this.tbCellPhone.PhoneNumber); dictionary.Add("##Login##", this.tbLoginID.Text); dictionary.Add("##Password##", this.tbPassword.Text); dictionary.Add("##VerificationURL##", string.Format(base.CurrentOrganization.Url + (base.CurrentOrganization.Url.EndsWith("/") ? "" : "/") + "default.aspx?page={0}&pid={1}&un={2}&org={3}&h={4}", new object[] { string.IsNullOrEmpty(this.NewUserVerificationPageSetting) ? "" : this.NewUserVerificationPageSetting, person.PersonID.ToString(), login2.LoginID, base.CurrentOrganization.OrganizationID.ToString(), this.CreateHash(login2.PersonID.ToString() + login2.DateCreated.ToString() + login2.LoginID) })); newUserAccountEmailVerification.Send(person.Emails.FirstActive, dictionary, login2.PersonID); } else { FormsAuthentication.SetAuthCookie(login2.LoginID, false); base.Response.Cookies["portalroles"].Value = string.Empty; } if (this.ProfileIDSetting != string.Empty) { int profileId = -1; int lookupID = -1; int lookupID2 = -1; try { if (this.ProfileIDSetting.Contains("|")) { profileId = int.Parse(this.ProfileIDSetting.Split(new char[] { '|' })[1]); } else { profileId = int.Parse(this.ProfileIDSetting); } lookupID = int.Parse(this.SourceLUIDSetting); lookupID2 = int.Parse(this.StatusLUIDSetting); } catch (System.Exception inner2) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "If using a ProfileID setting for the NewAccount module, then a valid numeric 'ProfileID', 'SourceLUID', and 'StatusLUID' setting must all be used!", inner2); } Profile profile = new Profile(profileId); Lookup lookup2 = new Lookup(lookupID); Lookup lookup3 = new Lookup(lookupID2); if (profile.ProfileID == -1 || lookup2.LookupID == -1 || lookup3.LookupID == -1) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "'ProfileID', 'SourceLUID', and 'StatusLUID' must all be valid IDs"); } ProfileMember profileMember = new ProfileMember(); profileMember.ProfileID = profile.ProfileID; profileMember.PersonID = person.PersonID; profileMember.Source = lookup2; profileMember.Status = lookup3; profileMember.DatePending = DateTime.Now; profileMember.Save(text2); if (profile.ProfileType == ProfileType.Serving) { ServingProfile servingProfile = new ServingProfile(profile.ProfileID); new ServingProfileMember(profileMember.ProfileID, profileMember.PersonID) { HoursPerWeek = servingProfile.DefaultHoursPerWeek }.Save(); } } string text3 = base.Session["RedirectValue"].ToString(); if (!string.IsNullOrEmpty(text3)) { base.Session["RedirectValue"] = null; base.Response.Redirect(text3); } }
/// <summary> /// Add a placemark object to a profile. If the placemark is a PersonPlacemark /// then the associated person record is used. If it is a FamilyPlacemark then /// all the members of the family are used. Otherwise the placemark is ignored. /// This method only adds individuals who are not already a member of the tag. /// </summary> /// <param name="placemark">The placemark to add to the profile.</param> /// <param name="profile">The profile to add the members to.</param> private void AddPlacemarkToProfile(Placemark placemark, Profile profile) { List <Person> people = new List <Person>(); // // Convert the placemark into a list of people that should be added. // if (placemark.GetType() == typeof(PersonPlacemark)) { people.Add(((PersonPlacemark)placemark).GetPerson()); } else if (placemark.GetType() == typeof(FamilyPlacemark)) { foreach (Person p in ((FamilyPlacemark)placemark).GetFamily().FamilyMembersActive) { people.Add(p); } } // // For each person found, verify that they should be added and then // add them if they are not already in the profile. // foreach (Person p in people) { ProfileMember pm; // // Verify they are an adult if the user wants only adults. // if (profileOnlyAdults.Checked == true) { FamilyMember fm = new FamilyMember(p.FamilyId, p.PersonID); if (!fm.FamilyRole.Guid.ToString().Equals("e410e1a6-8715-4bfb-bf03-1cd18051f815", StringComparison.InvariantCultureIgnoreCase)) { continue; } } // // Verify they are not already in the profile. // pm = new ProfileMember(profile.ProfileID, p); if (pm.ProfileID == -1) { pm = new ProfileMember(); // // Add them to the profile. // pm.ProfileID = profile.ProfileID; pm.PersonID = p.PersonID; pm.Source = ProfileSource; pm.Status = ProfileStatus; pm.DateActive = DateTime.Now; pm.Save(ArenaContext.Current.User.Identity.Name); // // If this is a serving profile, we need a little more information. // if (profile.ProfileType == Enums.ProfileType.Serving) { ServingProfile sp = new ServingProfile(profile.ProfileID); ServingProfileMember spm = new ServingProfileMember(pm.ProfileID, pm.PersonID); spm.HoursPerWeek = sp.DefaultHoursPerWeek; spm.Save(ArenaContext.Current.User.Identity.Name); } } } }
protected void Page_Load(object sender, System.EventArgs e) { int profileID = -1, i; ProfileCollection profiles; ServingProfile servingProfile; ProfileMember pm; CheckBox cb; Literal lt; BasePage.AddJavascriptInclude(Page, BasePage.JQUERY_INCLUDE); // // Deal with redirects. // if (!Page.IsPostBack) { iRedirect.Value = string.Empty; if (Request.QueryString["requestpage"] != null) { iRedirect.Value = string.Format("default.aspx?page={0}", Request.QueryString["requestpage"]); } if (iRedirect.Value == string.Empty && Request.QueryString["requestUrl"] != null) { iRedirect.Value = Request.QueryString["requestUrl"]; } if (iRedirect.Value == string.Empty) { iRedirect.Value = string.Format("default.aspx?page={0}", RedirectPageIDSetting); } } // // Retrieve the profile ID we are going to work with. // if (ProfileIDSetting.Contains("|")) { profileID = Int32.Parse(ProfileIDSetting.Split('|')[1]); } else { profileID = Int32.Parse(ProfileIDSetting); } // // Walk all the child profiles (only one level deep, non-recursive) // and add them as check-boxes to the page. If the user is already // a member of one of the profiles then that box is checked and // disabled. // profiles = new Profile(profileID).ChildProfiles; for (i = 0; i < profiles.Count; i++) { // // Find the member in the profile if they are already there. // pm = new ProfileMember(profiles[i].ProfileID, ArenaContext.Current.Person); // // Create either a CheckBox or a Radio button depending on module // settings. // if (MaxAnswersSetting == 1) { cb = (CheckBox) new RadioButton(); ((RadioButton)cb).GroupName = "ProfileGroup" + profileID.ToString(); } else { cb = new CheckBox(); } // // Fill in all the control information and add it to the list. // cb.ID = profiles[i].ProfileID.ToString(); cb.Text = profiles[i].Title; cb.CssClass = "sjt_profile"; if (pm.ProfileID != -1) { cb.Enabled = false; cb.Checked = true; cb.CssClass += " sjt_disabled"; } phProfiles.Controls.Add(cb); // // If this is a serving profile then make sure it isn't full. // if (profiles[i].ProfileType == ProfileType.Serving) { servingProfile = new ServingProfile(profiles[i].ProfileID); if (servingProfile.VolunteersNeeded > 0 && servingProfile.ProfileActiveMemberCount >= servingProfile.VolunteersNeeded) { cb.Enabled = false; cb.Text += " (currently full)"; cb.CssClass += " sjt_full"; } } // // Add in a newline character. // lt = new Literal(); lt.Text = "<br />"; phProfiles.Controls.Add(lt); } // // Add in a "none of the above" option if requested. This does // not do anything on submit, but resolves any "I changed my mind // how do I get out" questions. // if (NoneAboveSetting != false) { // // Create either the checkbox or the radio button depending on // the module setting. // if (MaxAnswersSetting == 1) { cb = (CheckBox) new RadioButton(); ((RadioButton)cb).GroupName = "ProfileGroup" + profileID.ToString(); } else { cb = new CheckBox(); } // // Setup the information about the none of the above control. // cb.ID = "-1"; cb.Text = "None of the above"; phProfiles.Controls.Add(cb); // // Add in a newline character. // lt = new Literal(); lt.Text = "<br />"; phProfiles.Controls.Add(lt); } }
/// <summary> /// Adds the person to the tag provided in the RedirectValue /// (similar to Arena's ProfileMemberAdd module) /// </summary> private void AddToTag(string queryString) { var activityNote = "Person added themself through web interface."; // Just in case there's no profile in the querystring AND in case it's not a number... try { var userID = (base.CurrentUser.Identity.Name != null && base.CurrentUser.Identity.Name != "") ? base.CurrentUser.Identity.Name : "UserConfirmation.ascx"; string[] values = queryString.Split('&'); var item = (from string q in values where q.StartsWith("profile=") select q).FirstOrDefault(); if (item == null) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "Profile id was missing from querystring."); } var notes = (from string q in values where q.StartsWith("Notes=") select q).FirstOrDefault(); var moreInfo = (from string q in values where q.StartsWith("MoreInfo") select q).FirstOrDefault(); int profileId = int.Parse(item.Split('=')[1]); Profile profile = new Profile(profileId); ProfileMember profileMember = new ProfileMember(profile.ProfileID, person); if (profileMember.ProfileID == -1) { int lookupID = -1; int lookupID2 = -1; try { lookupID = int.Parse(this.SourceLUIDSetting); lookupID2 = int.Parse(this.StatusLUIDSetting); } catch (Exception inner) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "A valid numeric 'Default Source ID', and 'Default Status ID' setting are required!", inner); } if (profile.ProfileType == ProfileType.Event) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "Event tags are not supported."); } else { profileMember.ProfileID = profile.ProfileID; profileMember.PersonID = person.PersonID; profileMember.Source = new Lookup(lookupID); profileMember.Status = new Lookup(lookupID2); profileMember.DatePending = DateTime.Now; if (moreInfo != null) { profileMember.MemberNotes += "User Requested More Information! "; } if (notes != null) { profileMember.MemberNotes += HttpUtility.UrlDecode(notes.Split('=')[1]); } profileMember.Save(userID); if (profile.ProfileType == ProfileType.Serving) { ServingProfile servingProfile = new ServingProfile(profile.ProfileID); new ServingProfileMember(profileMember.ProfileID, profileMember.PersonID) { HoursPerWeek = servingProfile.DefaultHoursPerWeek }.Save(); } } } else if (notes != null) { activityNote = HttpUtility.UrlDecode(notes.Split('=')[1]); } int lookupID3 = new Lookup(SystemLookup.ServingActivityType_StatusChange).LookupID; new ProfileMemberActivityData().SaveProfileMemberActivity(profile.ProfileID, person.PersonID, userID, lookupID3, activityNote); Response.Redirect(RedirectAfterSuccessURLSetting, true); } catch (Exception) { lblMessage.Text = "An error occurred which prevented us from adding you to that opportunity. Please contact the church office."; lblMessage.Visible = true; pnlMessage.Visible = true; } }
/// <summary> /// Saves the correct value from ProfileMember into the passed in PersonAttribute. /// If the Attribute is a YesNo attribute, then the Attribute for the ProfileMember will be marked as yes. /// If the Attribute is a DateTime attribute, then the value will be the DateActive value of the ProfileMember. /// If the Attribute is a Lookup, then the value will be the Lookup ID that has a matching Value to the MemberNotes property of the ProfileMember. /// If the Attribute is any other type, the value will be the MemberNotes. /// </summary> /// <param name="personAttribute"></param> /// <param name="member"></param> private bool SaveAttributeValue(PersonAttribute personAttribute, ProfileMember member, bool overwrite) { bool updated = false; try { switch (personAttribute.AttributeType) { case DataType.YesNo: if (overwrite || !personAttribute.HasIntValue) { personAttribute.IntValue = 1; updated = true; } break; case DataType.DateTime: if (overwrite || !personAttribute.HasDateValue) { personAttribute.DateValue = member.DateActive; updated = true; } break; case DataType.Lookup: if (!string.IsNullOrEmpty(member.MemberNotes.Trim()) && (overwrite || !personAttribute.HasIntValue)) { LookupType lt = new LookupType(int.Parse(personAttribute.TypeQualifier)); Lookup lookup = lt.Values.SingleOrDefault(l => l.Value.ToUpper() == member.MemberNotes.Trim().ToUpper()); if (lookup != null) { personAttribute.IntValue = lookup.LookupID; updated = true; } } break; default: if (overwrite || !personAttribute.HasStringValue) { personAttribute.StringValue = member.MemberNotes.Trim(); updated = true; } break; } if (updated) { personAttribute.Save(CurrentOrganization.OrganizationID, "TagsToAttributes"); // we must save the relationship between the document and the person if (personAttribute.AttributeType == DataType.Document) { if (personAttribute.IntValue != -1) { PersonDocument newDocument = new PersonDocument(personAttribute.PersonID, personAttribute.IntValue); newDocument.PersonID = personAttribute.PersonID; newDocument.DocumentID = personAttribute.IntValue; newDocument.SaveRelationship("TagsToAttributes"); } } } return(updated); } catch { throw; } }
public Contracts.ProfileMember GetProfileMember(int profileID, int personID) { ProfileMember member = new ProfileMember(profileID, personID); if (member.ProfileID == -1) throw new Arena.Services.Exceptions.ResourceNotFoundException("Invalid profile ID"); if (RestApi.ProfileOperationAllowed(ArenaContext.Current.Person.PersonID, member.ProfileID, OperationType.View) == false) throw new Exception("Access denied."); return new Contracts.ProfileMember(member); }
/// <summary> /// Saves the correct value from ProfileMember into the passed in PersonAttribute. /// If the Attribute is a YesNo attribute, then the Attribute for the ProfileMember will be marked as yes. /// If the Attribute is a DateTime attribute, then the value will be the DateActive value of the ProfileMember. /// If the Attribute is a Lookup, then the value will be the Lookup ID that has a matching Value to the MemberNotes property of the ProfileMember. /// If the Attribute is any other type, the value will be the MemberNotes. /// </summary> /// <param name="personAttribute"></param> /// <param name="member"></param> private bool SaveAttributeValue(PersonAttribute personAttribute, ProfileMember member, bool overwrite) { bool updated = false; try { switch (personAttribute.AttributeType) { case DataType.YesNo: if (overwrite || !personAttribute.HasIntValue) { personAttribute.IntValue = 1; updated = true; } break; case DataType.DateTime: if (overwrite || !personAttribute.HasDateValue) { personAttribute.DateValue = member.DateActive; updated = true; } break; case DataType.Lookup: if (!string.IsNullOrEmpty(member.MemberNotes.Trim()) && (overwrite || !personAttribute.HasIntValue)) { LookupType lt = new LookupType(int.Parse(personAttribute.TypeQualifier)); Lookup lookup = lt.Values.SingleOrDefault(l => l.Value.ToUpper() == member.MemberNotes.Trim().ToUpper()); if (lookup != null) { personAttribute.IntValue = lookup.LookupID; updated = true; } } break; default: if (overwrite || !personAttribute.HasStringValue) { personAttribute.StringValue = member.MemberNotes.Trim(); updated = true; } break; } if (updated) { personAttribute.Save(CurrentOrganization.OrganizationID, "TagsToAttributes"); // we must save the relationship between the document and the person if (personAttribute.AttributeType == DataType.Document) { if (personAttribute.IntValue != -1) { PersonDocument newDocument = new PersonDocument(personAttribute.PersonID, personAttribute.IntValue); newDocument.PersonID = personAttribute.PersonID; newDocument.DocumentID = personAttribute.IntValue; newDocument.SaveRelationship("TagsToAttributes"); } } } return updated; } catch { throw; } }
private void btnSubmit_Click(object sender, EventArgs e) { int i, profileID; CheckBox cbox; ProfileMember pm; Profile profile; Lookup luSource, luStatus; string userID = CurrentUser.Identity.Name; // // Lookup the profile source. // luSource = new Lookup(Int32.Parse(SourceLUIDSetting)); luStatus = new Lookup(Int32.Parse(StatusLUIDSetting)); if (luSource.LookupID == -1 || luStatus.LookupID == -1) { } // // Walk each of the controls found and determine if we need to // take any action for the value of that control. // for (i = 0; i < phProfiles.Controls.Count; i++) { // // If the control is not a checkbox or radio button then // ignore it. // if (phProfiles.Controls[i].GetType() != typeof(CheckBox) && phProfiles.Controls[i].GetType() != typeof(RadioButton)) { continue; } // // Pretend the control is a checkbox, if it is a radio button // it will cast fine since the radio button inherits from a // check box. // cbox = (CheckBox)phProfiles.Controls[i]; profileID = Int32.Parse(cbox.ID); profile = new Profile(profileID); // // If this control is turned on and it is not a "none of the above" // setting, then we need to take action. // if (cbox.Checked == true && profile.ProfileID != -1) { // // Verify this person is not already in the profile. // pm = new ProfileMember(profileID, ArenaContext.Current.Person); if (pm.ProfileID == -1) { // // The person needs to be added to the profile, generate all // the standard information. // pm = new ProfileMember(); pm.ProfileID = profileID; pm.PersonID = ArenaContext.Current.Person.PersonID; pm.Source = luSource; pm.Status = luStatus; pm.DatePending = DateTime.Now; pm.Save(userID); // // If the profile is a serving tag then we need to generate // a little bit more information. // if (profile.ProfileType == ProfileType.Serving) { ServingProfile sProfile = new ServingProfile(profile.ProfileID); ServingProfileMember sMember = new ServingProfileMember(pm.ProfileID, pm.PersonID); sMember.HoursPerWeek = sProfile.DefaultHoursPerWeek; sMember.Save(); } } } } // // Redirect browser back to originating page. // Response.Redirect(iRedirect.Value); }
public ActionResult BatchEdit(BatchEditViewModel model) { if (!ModelState.IsValid) { if (model.ProfileId.HasValue) { model.MemberList = GetAllMemberByProfileId(model.ProfileId.Value); model.MemberWhichIsNotIncludeList = GetAllMemberByProfileIdWhichIsNotIncluded(model.ProfileId.Value); } else { model.MemberList = new List <MemberCheckViewModel>(); model.MemberWhichIsNotIncludeList = new List <MemberCheckViewModel>(); } return(View(model)); } if (model.SubmitType == "Add") { if (model.MemberWhichIsNotIncludeList != null && model.ProfileId.HasValue) { ModelState.Clear(); List <MemberCheckViewModel> records = model.MemberWhichIsNotIncludeList.Where(x => x.Checked == true).ToList(); if (records != null) { foreach (var item in records) { ProfileMember profileMember = new ProfileMember(); profileMember.MemberId = item.ID; profileMember.ProfileId = model.ProfileId.Value; _profileMemberService.Add(profileMember); } } } } if (model.SubmitType == "Delete") { if (model.MemberList != null && model.ProfileId.HasValue) { ModelState.Clear(); List <MemberCheckViewModel> record = model.MemberList.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { var apiResponseModel = _profileMemberService.DeleteByProfileIdAndEmployeeId(model.ProfileId.Value, item.ID); } } } } model.ProfileSelectList = GetProfileSelectList(); if (model.ProfileId.HasValue) { model.MemberList = GetAllMemberByProfileId(model.ProfileId.Value); model.MemberWhichIsNotIncludeList = GetAllMemberByProfileIdWhichIsNotIncluded(model.ProfileId.Value); } else { model.MemberList = new List <MemberCheckViewModel>(); model.MemberWhichIsNotIncludeList = new List <MemberCheckViewModel>(); } return(View(model)); }
private void CreateAccount() { Arena.Security.Login login; string loginID; if (CustomLoginSetting == true) { // Ensure that login ID is unique loginID = tbLoginID.Text; login = new Arena.Security.Login(loginID); if (login.PersonID != -1) { int loginCount = 0; loginID = tbFirstName.Text.Substring(0, 1).ToLower() + tbLastName.Text.Trim().ToLower(); if (loginID != loginID.ToLower()) { login = new Arena.Security.Login(loginID); } while (login.PersonID != -1) { loginCount++; login = new Arena.Security.Login(loginID + loginCount.ToString()); } lblMessage.Text = "The Desired Login ID you selected is already in use in our system. Please select a different Login ID. Suggestion: <b>" + loginID + loginCount.ToString() + "</b>"; pnlMessage.Visible = true; lblMessage.Visible = true; return; } } else { Int32 loginCount = 0; // // Construct a login Id that can be used. // do { if (loginCount == 0) { loginID = tbFirstName.Text + " " + tbLastName.Text; } else { loginID = tbFirstName.Text + " " + tbLastName.Text + loginCount.ToString(); } loginID = loginID.ToLower(); login = new Arena.Security.Login(loginID); loginCount++; } while (login.PersonID != -1); } Lookup memberStatus; try { memberStatus = new Lookup(Int32.Parse(MemberStatusIDSetting)); if (memberStatus.LookupID == -1) { throw new ModuleException(CurrentPortalPage, CurrentModule, "Member Status setting must be a valid Member Status Lookup value."); } } catch (System.Exception ex) { throw new ModuleException(CurrentPortalPage, CurrentModule, "Member Status setting must be a valid Member Status Lookup value.", ex); } int organizationID = CurrentPortal.OrganizationID; string userID = CurrentUser.Identity.Name; if (userID == string.Empty) { userID = "NewAccount.ascx"; } Person person = new Person(); person.RecordStatus = RecordStatus.Pending; person.MemberStatus = memberStatus; if (CampusSetting != string.Empty) { try { person.Campus = new Arena.Organization.Campus(Int32.Parse(CampusSetting)); } catch { person.Campus = null; } } person.FirstName = tbFirstName.Text.Trim(); person.LastName = tbLastName.Text.Trim(); if (tbBirthDate.Text.Trim() != string.Empty) { try { person.BirthDate = DateTime.Parse(tbBirthDate.Text); } catch { } } if (ddlMaritalStatus.SelectedValue != string.Empty) { person.MaritalStatus = new Lookup(Int32.Parse(ddlMaritalStatus.SelectedValue)); } if (ddlGender.SelectedValue != string.Empty) { try { person.Gender = (Gender)Enum.Parse(typeof(Gender), ddlGender.SelectedValue); } catch { } } PersonAddress personAddress = new PersonAddress(); personAddress.Address = new Address( tbStreetAddress.Text.Trim(), string.Empty, tbCity.Text.Trim(), ddlState.SelectedValue, tbZipCode.Text.Trim(), false); personAddress.AddressType = new Lookup(SystemLookup.AddressType_Home); personAddress.Primary = true; person.Addresses.Add(personAddress); PersonPhone phone = new PersonPhone(); phone.Number = tbHomePhone.PhoneNumber.Trim(); phone.PhoneType = new Lookup(SystemLookup.PhoneType_Home); person.Phones.Add(phone); if (tbWorkPhone.PhoneNumber.Trim() != string.Empty) { phone = new PersonPhone(); phone.Number = tbWorkPhone.PhoneNumber.Trim(); phone.Extension = tbWorkPhone.Extension; phone.PhoneType = new Lookup(SystemLookup.PhoneType_Business); person.Phones.Add(phone); } if (tbCellPhone.PhoneNumber.Trim() != string.Empty) { phone = new PersonPhone(); phone.Number = tbCellPhone.PhoneNumber.Trim(); phone.PhoneType = new Lookup(SystemLookup.PhoneType_Cell); phone.SMSEnabled = cbSMS.Checked; person.Phones.Add(phone); } if (tbEmail.Text.Trim() != string.Empty) { PersonEmail personEmail = new PersonEmail(); personEmail.Active = true; personEmail.Email = tbEmail.Text.Trim(); person.Emails.Add(personEmail); } person.Save(organizationID, userID, false); person.SaveAddresses(organizationID, userID); person.SavePhones(organizationID, userID); person.SaveEmails(organizationID, userID); Family family = new Family(); family.OrganizationID = organizationID; family.FamilyName = tbLastName.Text.Trim() + " Family"; family.Save(userID); FamilyMember fm = new FamilyMember(family.FamilyID, person.PersonID); fm.FamilyID = family.FamilyID; fm.FamilyRole = new Lookup(SystemLookup.FamilyRole_Adult); fm.Save(userID); Arena.Security.Login personLogin = new Arena.Security.Login(); personLogin.PersonID = person.PersonID; personLogin.LoginID = loginID; personLogin.Password = tbPassword.Text.Trim(); personLogin.Active = true; personLogin.Save(userID); // Use security system to set the UserID within a client-side Cookie FormsAuthentication.SetAuthCookie(personLogin.LoginID, false); Response.Cookies["portalroles"].Value = string.Empty; if (ProfileIDSetting != string.Empty) { int profileID = -1; int sourceLUID = -1; int statusLUID = -1; try { if (ProfileIDSetting.Contains("|")) { profileID = Int32.Parse(ProfileIDSetting.Split('|')[1]); } else { profileID = Int32.Parse(ProfileIDSetting); } sourceLUID = Int32.Parse(SourceLUIDSetting); statusLUID = Int32.Parse(StatusLUIDSetting); } catch (System.Exception ex) { throw new ModuleException(CurrentPortalPage, CurrentModule, "If using a ProfileID setting for the NewAccount module, " + "then a valid numeric 'ProfileID', 'SourceLUID', and 'StatusLUID' setting must all be used!", ex); } Profile profile = new Profile(profileID); Lookup sourceLu = new Lookup(sourceLUID); Lookup statusLu = new Lookup(statusLUID); if (profile.ProfileID != -1 && sourceLu.LookupID != -1 && statusLu.LookupID != -1) { ProfileMember profileMember = new ProfileMember(); profileMember.ProfileID = profile.ProfileID; profileMember.PersonID = person.PersonID; profileMember.Source = sourceLu; profileMember.Status = statusLu; profileMember.DatePending = DateTime.Now; profileMember.Save(userID); if (profile.ProfileType == ProfileType.Serving) { ServingProfile sProfile = new ServingProfile(profile.ProfileID); ServingProfileMember sMember = new ServingProfileMember(profileMember.ProfileID, profileMember.PersonID); sMember.HoursPerWeek = sProfile.DefaultHoursPerWeek; sMember.Save(); } } else { throw new ModuleException(CurrentPortalPage, CurrentModule, "'ProfileID', 'SourceLUID', and 'StatusLUID' must all be valid IDs"); } } // // If we are letting the user pick their own login ID then just redirect // the browser back to the originating page. Otherwise put up some text to // tell the user what their new login ID is. // if (CustomLoginSetting == true) { Response.Redirect(iRedirect.Value); } else { pnlCreateAccount.Visible = false; lbLoginCreated.Text = "Your account has been created. Your login ID is \"" + loginID + "\".<BR /><BR />You may use this login ID the next time you visit this site.<BR />"; pnlLoginCreated.Visible = true; } }
private void UpdateAccount() { int organizationID = base.CurrentPortal.OrganizationID; string text = base.CurrentUser.Identity.Name; if (text == string.Empty) { text = "UserConfirmation.ascx"; } // New cccev code... if (this.person.PersonID == -1) { TryFindExistingPerson(); } // End cccev code Person oldPerson = new Person(this.person.PersonID); bool isNewPerson = this.person.PersonID == -1; if (isNewPerson) { this.person.RecordStatus = RecordStatus.Pending; Lookup lookup; try { lookup = new Lookup(int.Parse(this.MemberStatusIDSetting)); if (lookup.LookupID == -1) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "Member Status setting must be a valid Member Status Lookup value."); } } catch (System.Exception inner) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "Member Status setting must be a valid Member Status Lookup value.", inner); } this.person.MemberStatus = lookup; if (this.CampusSetting != string.Empty) { try { this.person.Campus = new Campus(int.Parse(this.CampusSetting)); } catch { this.person.Campus = null; } } else if (RequireCampusSetting) { this.person.Campus = new Campus(int.Parse(this.ddlCampus.SelectedValue)); } } this.person.FirstName = this.tbFirstName.Text.Trim(); this.person.LastName = this.tbLastName.Text.Trim(); this.person.Emails.FirstActive = this.tbEmail.Text.Trim(); // Campus if (RequireCampusSetting) { this.person.Campus = new Campus(int.Parse(this.ddlCampus.SelectedValue)); } // Birth Date if (RequireBirthDateSetting && this.tbBirthDate.Text.Trim() != string.Empty) // Cccev { try { this.person.BirthDate = DateTime.Parse(this.tbBirthDate.Text); } catch { } } // Marital Status if (RequireMaritalStatusSetting && this.ddlMaritalStatus.SelectedValue != string.Empty) // Cccev { this.person.MaritalStatus = new Lookup(int.Parse(this.ddlMaritalStatus.SelectedValue)); } // Gender if (RequireGenderSetting && this.ddlGender.SelectedValue != string.Empty) // Cccev { try { this.person.Gender = (Gender)Enum.Parse(typeof(Gender), this.ddlGender.SelectedValue); } catch { } } // Address Lookup lookup2 = new Lookup(SystemLookup.AddressType_Home); PersonAddress personAddress = this.person.Addresses.FindByType(lookup2.LookupID); if (personAddress == null) { personAddress = new PersonAddress(); personAddress.AddressType = lookup2; this.person.Addresses.Add(personAddress); } if (RequireAddressSetting) // Cccev { personAddress.Address = new Address(this.tbStreetAddress.Text.Trim(), string.Empty, this.tbCity.Text.Trim(), this.ddlState.SelectedValue, this.tbZipCode.Text.Trim(), false); personAddress.Primary = true; } // Home Phone Lookup lookup3 = new Lookup(SystemLookup.PhoneType_Home); PersonPhone personPhone = this.person.Phones.FindByType(lookup3.LookupID); if (personPhone == null) { personPhone = new PersonPhone(); personPhone.PhoneType = lookup3; this.person.Phones.Add(personPhone); } if (RequireHomePhoneSetting) // Cccev { personPhone.Number = this.tbHomePhone.PhoneNumber.Trim(); } // Business Phone Lookup lookup4 = new Lookup(SystemLookup.PhoneType_Business); PersonPhone personPhone2 = this.person.Phones.FindByType(lookup4.LookupID); if (personPhone2 == null) { personPhone2 = new PersonPhone(); personPhone2.PhoneType = lookup4; this.person.Phones.Add(personPhone2); } if (RequireWorkPhoneSetting) // Cccev { personPhone2.Number = this.tbWorkPhone.PhoneNumber.Trim(); } // Cell Phone Lookup lookup5 = new Lookup(SystemLookup.PhoneType_Cell); PersonPhone personPhone3 = this.person.Phones.FindByType(lookup5.LookupID); if (personPhone3 == null) { personPhone3 = new PersonPhone(); personPhone3.PhoneType = lookup5; this.person.Phones.Add(personPhone3); } if (RequireCellPhoneSetting) // Cccev { personPhone3.Number = this.tbCellPhone.PhoneNumber.Trim(); personPhone3.SMSEnabled = this.cbCellSMS.Checked; } string personChanges = this.GetPersonChanges(oldPerson, this.person, isNewPerson); this.person.Save(organizationID, text, false); this.person.SaveAddresses(organizationID, text); this.person.SavePhones(organizationID, text); this.person.SaveEmails(organizationID, text); this.SaveAttributeValues(this.person); if (isNewPerson) { string userName = new LoginData().CreateNewLogin(this.person.PersonID, text); FormsAuthentication.SetAuthCookie(userName, false); base.Response.Cookies["portalroles"].Value = string.Empty; Family family = new Family(); family.OrganizationID = organizationID; family.FamilyName = this.tbLastName.Text.Trim() + " Family"; family.Save(text); new FamilyMember(family.FamilyID, this.person.PersonID) { FamilyID = family.FamilyID, FamilyRole = new Lookup(SystemLookup.FamilyRole_Adult) }.Save(text); if (this.ProfileIDSetting != string.Empty) { int profileId = -1; int lookupID = -1; int lookupID2 = -1; try { if (this.ProfileIDSetting.Contains("|")) { profileId = int.Parse(this.ProfileIDSetting.Split(new char[] { '|' })[1]); } else { profileId = int.Parse(this.ProfileIDSetting); } lookupID = int.Parse(this.SourceLUIDSetting); lookupID2 = int.Parse(this.StatusLUIDSetting); } catch (System.Exception inner2) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "If using a ProfileID setting for the NewAccount module, then a valid numeric 'ProfileID', 'SourceLUID', and 'StatusLUID' setting must all be used!", inner2); } Profile profile = new Profile(profileId); Lookup lookup6 = new Lookup(lookupID); Lookup lookup7 = new Lookup(lookupID2); if (profile.ProfileID == -1 || lookup6.LookupID == -1 || lookup7.LookupID == -1) { throw new ModuleException(base.CurrentPortalPage, base.CurrentModule, "'ProfileID', 'SourceLUID', and 'StatusLUID' must all be valid IDs"); } ProfileMember profileMember = new ProfileMember(); profileMember.ProfileID = profile.ProfileID; profileMember.PersonID = this.person.PersonID; profileMember.Source = lookup6; profileMember.Status = lookup7; profileMember.DatePending = DateTime.Now; profileMember.Save(text); if (profile.ProfileType == ProfileType.Serving) { ServingProfile servingProfile = new ServingProfile(profile.ProfileID); new ServingProfileMember(profileMember.ProfileID, profileMember.PersonID) { HoursPerWeek = servingProfile.DefaultHoursPerWeek }.Save(); } } } if (this.NotifySetting != string.Empty) { this.SendNotification(this.person, personChanges); } string text2 = base.Session["RedirectValue"].ToString().Trim(); if (this.tbNotes.Text.Trim() != string.Empty) { text2 = text2 + "&Notes=" + (this.tbNotes.Text.Trim()); } if (text2 != string.Empty) { AddToTag(text2); base.Session["RedirectValue"] = null; //text2 += "&confirmed=true"; //base.Response.Redirect(text2, true); } }