private void btnSend_Click(object sender, EventArgs e) { int groupid = -1; string strLeaderEmail = ""; string strClusterLeaderEmail = ""; foreach (DataGridItem item in dgResults.Items) { RadioButton rb = (RadioButton)item.FindControl("rbSelect"); if (rb.Checked) { groupid = Int32.Parse(rb.Attributes["groupid"]); break; } } bool sendClusterLeaderEmail = bool.Parse(SendClusterLeaderEmailSetting); Group group = new Group(groupid); strLeaderEmail = group.Leader.Emails.FirstActive; if (strLeaderEmail.Length == 0 || sendClusterLeaderEmail) { GroupCluster parentCluster = group.GroupCluster; while (parentCluster.GroupClusterID != -1) { if (parentCluster.Leader.Emails.FirstActive != string.Empty) { strLeaderEmail = (!string.IsNullOrEmpty(strLeaderEmail) ? strLeaderEmail : parentCluster.Leader.Emails.FirstActive); strClusterLeaderEmail = parentCluster.Leader.Emails.FirstActive; break; } else if (parentCluster.Admin != null && parentCluster.Admin.PersonID != parentCluster.Leader.PersonID && parentCluster.Admin.Emails.FirstActive != string.Empty) { strLeaderEmail = (!string.IsNullOrEmpty(strLeaderEmail) ? strLeaderEmail : parentCluster.Admin.Emails.FirstActive); strClusterLeaderEmail = parentCluster.Admin.Emails.FirstActive; break; } parentCluster = new GroupCluster(parentCluster.ParentClusterID); } } if (strLeaderEmail.Length == 0 && GroupLeaderEmailSetting != string.Empty) { strLeaderEmail = GroupLeaderEmailSetting; } else if (strLeaderEmail.Length == 0) { strLeaderEmail = CurrentOrganization.Settings["GroupLocatorEmail"]; } SmallGroupLocator smallGroupLocator = new SmallGroupLocator(); Dictionary <string, string> fields = new Dictionary <string, string>(); fields.Add("##GroupName##", group.Title); fields.Add("##GroupID##", group.GroupID.ToString()); fields.Add("##Name##", tbName.Text); fields.Add("##Phone##", tbPhone.PhoneNumber); fields.Add("##Email##", tbEmail.Text); fields.Add("##Notes##", tbNotes.Text); smallGroupLocator.Send(strLeaderEmail, fields); if (sendClusterLeaderEmail && strLeaderEmail != strClusterLeaderEmail) { smallGroupLocator.Send(strClusterLeaderEmail, fields); } //set pending registratant if (PendingRegistraintSetting.ToLower() == "true" && CurrentPerson != null && CurrentPerson.PersonID != -1) { Registration registration = new Registration(); registration.OrganizationID = CurrentPortal.OrganizationID; if (_useGroupType) { Lookup grpType = group.GroupType; try { registration.ClusterType = new ClusterType(Int32.Parse(grpType.Qualifier)); } catch { throw new ArenaApplicationException(string.Format("Invalid Cluster Type ID for Small Group Type '{0}'", grpType.Value)); } registration.GroupType = grpType; } else { registration.ClusterType = group.ClusterType; registration.GroupType = null; } if (group.GroupType.ToString() != string.Empty) { registration.GroupType = group.GroupType; } registration.Notes = tbNotes.Text; registration.Persons.Add(CurrentPerson); registration.DayOfWeek.Add(group.MeetingDay); registration.AgeRange.Add(group.PrimaryAge); registration.MaritalPreference.Add(group.PrimaryMaritalStatus); registration.SetCluster(); registration.GroupID = group.GroupID; registration.Save(CurrentPortal.OrganizationID, CurrentUser.Identity.Name); } Response.Redirect(string.Format("~/default.aspx?page={0}", RedirectPageIDSetting.ToString()), true); }
protected void Page_Load(object sender, System.EventArgs e) { BasePage.AddJavascriptInclude(Page, "http://code.jquery.com/jquery-latest.min.js"); //BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/bbq.js"); //BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/inputs.js"); BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/jquery.xml2json.js"); BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/jquery-ui-1.8.10.custom.min.js"); BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/jquery.cookie.js"); //BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/jquery.form.js"); //BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/jquery.form.wizard-3.0.5.min.js"); BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/jquery.inputmask.js"); BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/jquery.validate.min.js"); BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/tofsla_forms.js"); BasePage.AddJavascriptInclude(Page, "UserControls/Custom/WVC/MinPart/js/minpart_custom.js"); BasePage.AddCssLink(Page, "UserControls/Custom/WVC/MinPart/css/minpart_screen_custom.css", "screen"); // // 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); } var maritalStatuses = new LookupType(84); /*for (int i = 0; i < maritalStatuses.Values.Count; i++) { maritalStatus.Items.Add(Convert.ToString(maritalStatuses.Values[i])); }*/ for (int i = Convert.ToInt16(DateTime.Now.Year)-120; i <= Convert.ToInt16(DateTime.Now.Year); i++) { birthYear.Items.Add(Convert.ToString(i)); } signedYear.Items.Add(Convert.ToString(DateTime.Now.Year)); var person = new Person(ArenaContext.Current.Person); print.HRef = String.Join("",new String[] {ArenaContext.Current.ServerUrl,"/default.aspx?page=",PrintPageIDSetting.ToString(),"&guid=",ArenaContext.Current.Person.Guid.ToString()} ); postLocation.Value = String.Join("", new String[] {ArenaContext.Current.ServerUrl,"/default.aspx?page=",RedirectPageIDSetting.ToString()} ); user_name.Value = person.Logins[0].LoginID; firstName.Value = person.FirstName; lastName.Value = person.LastName; email.Value = person.Emails.FirstActive; maritalStatus.Value = person.MaritalStatus.ToString(); gender.Value = person.Gender.ToString(); birthYear.Value = person.BirthDate.Year.ToString(); birthMonth.Value = person.BirthDate.Month.ToString(); birthDay.Value = person.BirthDate.Day.ToString(); socialsecurity.Value = person.SSN.ToString(); foreach (PersonAddress address in person.Addresses) { if (address.Primary) { streetAddress1.Value = address.Address.StreetLine1; streetAddress2.Value = address.Address.StreetLine2; city.Value = address.Address.City; zipCode.Value = address.Address.PostalCode; state.Value = address.Address.State; } } foreach (PersonPhone phone in person.Phones) { switch (phone.PhoneType.Value) { case "Main/Home": homePhone.Value = phone.Number; break; case "Business": workPhone.Value = phone.Number; break; case "Cell": cellPhone.Value = phone.Number; cellsms.Checked = phone.SMSEnabled; break; default: break; } } foreach (Control field in this.Controls) { // check this out.. if (field.GetType() == typeof(HtmlInputText)) { var tb = (HtmlInputText)Convert.ChangeType(field, typeof(HtmlInputText)); if (tb.Attributes["attid"] != null) { var pa = new PersonAttribute(person.PersonID, (int)Convert.ChangeType(tb.Attributes["attid"], typeof(int))); tb.Value = Convert.ToString(pa); } } else if (field.GetType() == typeof(HtmlTextArea)) { var tb = (HtmlTextArea)Convert.ChangeType(field, typeof(HtmlTextArea)); if (tb.Attributes["attid"] != null) { var pa = new PersonAttribute(person.PersonID, (int)Convert.ChangeType(tb.Attributes["attid"], typeof(int))); tb.Value = Convert.ToString(pa); } } else if (field.GetType() == typeof(HtmlInputRadioButton)) { var tb = (HtmlInputRadioButton)Convert.ChangeType(field, typeof(HtmlInputRadioButton)); if (tb.Attributes["attid"] != null) { var pa = new PersonAttribute(person.PersonID, (int)Convert.ChangeType(tb.Attributes["attid"], typeof(int))); if ((pa.IntValue == 1) && (tb.Value == "Yes")) { tb.Attributes["checked"] = Convert.ToString(pa); } else if ((pa.IntValue == 0) && (tb.Value == "No")) { tb.Attributes["checked"] = Convert.ToString(pa); } } } } }