private void btnSubmit_Click(object sender, EventArgs e) { PersonAttribute attribute; int i; for (i = 0; i < phAttributes.Controls.Count; i++) { // // Load the person attribute if the ID is not -1. // if (phAttributes.Controls[i].ID == "-1") { continue; } attribute = new PersonAttribute(CurrentPerson.PersonID, Convert.ToInt32(phAttributes.Controls[i].ID)); if (phAttributes.Controls[i].GetType() == typeof(CheckBox)) { CheckBox cbox = (CheckBox)phAttributes.Controls[i]; attribute.IntValue = Convert.ToInt32(cbox.Checked); attribute.Save(CurrentOrganization.OrganizationID, CurrentUser.Identity.Name); } else if (phAttributes.Controls[i].GetType() == typeof(TextBox)) { TextBox tb = (TextBox)phAttributes.Controls[i]; attribute.StringValue = HttpUtility.HtmlEncode(tb.Text); attribute.Save(CurrentOrganization.OrganizationID, CurrentUser.Identity.Name); } } // // Redirect browser back to originating page. // Response.Redirect(iRedirect.Value); }
public static void SavePcoLastSyncArena(Lookup pcoAccount, Person person, XDocument details, string userId) { PersonAttribute pa = GetPcoLastSyncArenaAttribute(pcoAccount, person); Arena.Document.PersonDocument personDocument = new Arena.Document.PersonDocument(person.PersonID, pa.IntValue); personDocument.PersonID = person.PersonID; using (MemoryStream stream = new MemoryStream()) { XmlWriterSettings settings = new XmlWriterSettings(); using (XmlWriter writer = XmlWriter.Create(stream, settings)) { details.Save(writer); } personDocument.ByteArray = stream.ToArray(); } personDocument.OriginalFileName = "ArenaPerson.xml"; personDocument.FileExtension = "xml"; personDocument.MimeType = "application/xml"; personDocument.Title = "Last PCO Sync Arena Data"; personDocument.Description = string.Format("Arena Attributes for {0}({1})", person.FullName, person.PersonGUID.ToString()); personDocument.Save(userId); pa.IntValue = personDocument.DocumentID; pa.Save(person.OrganizationID, userId); }
public static void SavePcoPassword(Lookup pcoAccount, Person person, string password, string userId) { PersonAttribute pa = GetPcoPasswordAttribute(pcoAccount, person); pa.StringValue = password; pa.Save(person.OrganizationID, userId); }
public static void SavePcoID(Lookup pcoAccount, Person person, int pcoID, string userId) { PersonAttribute pa = GetPcoIDAttribute(pcoAccount, person); pa.IntValue = pcoID; pa.Save(person.OrganizationID, userId); }
private static void SavePersonAttribute(Person person, string facebookID, int orgID) { var attribute = new Arena.Core.Attribute(SystemGuids.FACEBOOK_USER_ID_ATTRIBUTE); var facebookSetting = new PersonAttribute { PersonID = person.PersonID, AttributeId = attribute.AttributeId, StringValue = facebookID }; facebookSetting.Save(orgID, CREATED_BY); }
protected void rblPreference_CheckedChanged(object sender, EventArgs e) { pnlFail.Visible = false; pnlSuccess.Visible = false; try { PersonAttribute selectedFrequency = new PersonAttribute(CurrentPerson.PersonID, int.Parse(FrequencyPreferenceAttributeIDSetting)); selectedFrequency.IntValue = int.Parse(rblPreference.SelectedValue); selectedFrequency.Save(CurrentOrganization.OrganizationID, CurrentUser.Identity.Name); pnlSuccess.Visible = true; } catch { pnlFail.Visible = true; } }
private void AttachDocument() { Person person = null; using (personSearchForm = new PersonSearchForm()) { personSearchForm.ShowDialog(); person = personSearchForm.SelectedPerson; personSearchForm.Dispose(); } if (person != null) { this.Cursor = Cursors.WaitCursor; string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name; myDocType docType = (myDocType)getCheckedMenuItem(miDocumentType).Tag; PersonAttribute pa = new PersonAttribute(person.PersonID, docType.AttributeId); if (pa.IntValue == -1 || MessageBox.Show( string.Format("{0} already has a {1} document associated with their record. Do you want to overwrite the existing document?", person.NickName, docType.TypeName), "Document Already Exists", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { Arena.Utility.ArenaDataBlob blob = new Arena.Utility.ArenaDataBlob(pa.IntValue); Atalasoft.Imaging.Codec.Pdf.PdfEncoder pdf = new Atalasoft.Imaging.Codec.Pdf.PdfEncoder(); pdf.Metadata = new Atalasoft.Imaging.Codec.Pdf.PdfMetadata( person.FullName, "", docType.DocType.TypeName, "", organization.Name, "", DateTime.Now, DateTime.Now); string fileName = string.Format("{0}_{1}.pdf", person.FullName.Replace(" ", ""), docType.TypeName.Replace(" ", "")); blob.SetFileInfo(fileName); using (MemoryStream ms = new MemoryStream()) { ScannedImages.Save(ms, pdf, null); blob.ByteArray = ms.ToArray(); ms.Close(); } blob.Cache = false; blob.DocumentTypeID = docType.DocType.DocumentTypeId; blob.Title = docType.DocType.TypeName; pa.IntValue = blob.Save(userName); pa.PersonID = person.PersonID; pa.AttributeId = docType.AttributeId; pa.Save(organizationID, userName); PersonDocument pDoc = new PersonDocument(person.PersonID, pa.IntValue); pDoc.PersonID = person.PersonID; pDoc.DocumentID = pa.IntValue; pDoc.SaveRelationship(userName); ScannedImages.Clear(); tViewer.Items.Clear(); RefreshView(); } this.Cursor = Cursors.Default; } }
/// <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 static void SavePersonAttribute(Person person, string facebookID, int orgID) { var attribute = new Arena.Core.Attribute(SystemGuids.FACEBOOK_USER_ID_ATTRIBUTE); var facebookSetting = new PersonAttribute { PersonID = person.PersonID, AttributeId = attribute.AttributeId, StringValue = facebookID }; facebookSetting.Save(orgID, CREATED_BY); }
/// <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; } }