public AddMemberNoteView(MemberModel memberModel, MemberNoteModel memberNote = null) { InitializeComponent(); DataContext = ViewModel = new AddMemberNoteViewModel(memberModel, memberNote); Owner = Application.Current.MainWindow; }
public MemberUpdateDetailsView(MemberModel member) { InitializeComponent(); DataContext = _viewModel = new MemberUpdateDetailsViewModel(member); IsVisibleChanged += OnIsVisibleChanged; }
public MemberNotesView(MemberModel member) { InitializeComponent(); DataContext = _viewModel = new MemberNotesViewModel(member); _viewModel.PropertyChanged += ViewModelOnPropertyChanged; RadGridViewNotes.MouseDoubleClick += RadGridViewNotes_MouseDoubleClick; }
public AddMemberView(MemberModel member = null) { InitializeComponent(); DataContext = ViewModel = new AddMemberViewModel(member); ViewModel.PropertyChanged += ViewModelOnPropertyChanged; Owner = Application.Current.MainWindow; Loaded += OnAddMemberViewLoaded; }
public AddMemberNoteViewModel(MemberModel memberModel, MemberNoteModel noteModel) { Member = memberModel; var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>(); _membershipDataUnit = dataUnitLocator.ResolveDataUnit<IMembershipDataUnit>(); SubmitCommand = new RelayCommand(SubmitCommandExecuted, SubmitCommandCanExecute); CancelCommand = new RelayCommand(CancelCommandExecuted); ProcessNote(noteModel); }
public MemberNotesViewModel(MemberModel member) { var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>(); _membershipDataUnit = dataUnitLocator.ResolveDataUnit<IMembershipDataUnit>(); AddNoteCommand = new RelayCommand(AddNoteCommandExecuted); DeleteNoteCommand = new RelayCommand<MemberNoteModel>(DeleteNoteCommandExecuted); EditNoteCommand = new RelayCommand<MemberNoteModel>(EditNoteCommandExecuted); ProcessMember(member); }
private void EditNoteCommandExecuted(MemberNoteModel memberNote) { RaisePropertyChanged("DisableParentWindow"); SelectedNote = memberNote; _originalMember = Member.Clone(); var window = new AddMemberNoteView(Member, memberNote); window.ShowDialog(); if (window.DialogResult != null && window.DialogResult.Value) { ProcessUpdates(); memberNote.Refresh(); } RaisePropertyChanged("EnableParentWindow"); }
private void AddNoteCommandExecuted() { RaisePropertyChanged("DisableParentWindow"); _originalMember = Member.Clone(); var window = new AddMemberNoteView(Member); window.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); if (window.DialogResult != null && window.DialogResult.Value) { Member.MemberNotes.Add(window.ViewModel.MemberNote); ProcessUpdates(); SelectedNote = window.ViewModel.MemberNote; } }
public ContactDetailsViewModel(ContactModel model, bool isFromMembership, MemberModel member) { IsFromMembership = isFromMembership; if (member != null) { _originalMember = member.Clone(); Member = member; } var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>(); if (IsFromMembership) _membershipDataUnit = dataUnitLocator.ResolveDataUnit<IMembershipDataUnit>(); else _contactsDataUnit = dataUnitLocator.ResolveDataUnit<IContactsDataUnit>(); SaveChangesCommand = new RelayCommand(SaveChangesCommandExecute, SaveChangesCommandCanExecute); if (IsFromMembership) CanEdit = AccessService.Current.UserHasPermissions(Resources.PERMISSION_MEMBERSHIP_EDIT_CONTACT_ALLOWED); else CanEdit = AccessService.Current.UserHasPermissions(Resources.PERMISSION_EDIT_CONTACT_ALLOWED); if (IsFromMembership) ProcessContact(Member.Contact); else ProcessContact(model); }
private async void ProcessUpdates() { if (!Member.MembershipUpdates.Any()) { var updates = await _membershipDataUnit.MembershipUpdatesRepository.GetAllAsync(x => x.MemberID == Member.Member.ID); Member.MembershipUpdates = new ObservableCollection<MembershipUpdate>(updates.OrderByDescending(x => x.Date)); } var membershipUpdates = LoggingService.FindDifference(_originalMember, Member, "Member"); membershipUpdates.ForEach(update => { Member.MembershipUpdates.Insert(0, update); _membershipDataUnit.MembershipUpdatesRepository.Add(update); }); Member.MembershipUpdates = new ObservableCollection<MembershipUpdate>(Member.MembershipUpdates.OrderByDescending(x => x.Date)); await _membershipDataUnit.SaveChanges(); _originalMember = Member.Clone(); }
public static List<MembershipUpdate> FindDifference(MemberModel currentMember, MemberModel nextMember, string type, bool isNewMembership = false) { var membershipUpdates = new List<MembershipUpdate>(); try { if (type == "Member") { if (isNewMembership) { // Member if (string.IsNullOrEmpty(currentMember.Contact.LastName) && !string.IsNullOrEmpty(nextMember.Contact.LastName)) { var message = string.Format("Added: Member {0}", nextMember.Contact.ContactName); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.ContactName, nextMember.Member.ID, "Member", "Name", UpdateAction.Added); membershipUpdates.Add(update); } // Category if (currentMember.Category == null && nextMember.Category != null) { var message = string.Format("Added: Category {0}", nextMember.Category.Name); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Category.Name, nextMember.Member.ID, "Member", "Category", UpdateAction.Added); membershipUpdates.Add(update); } // Start Date if (currentMember.StartDate == null && nextMember.StartDate != null) { var message = string.Format("Added: Start Date {0}", Convert.ToDateTime(nextMember.StartDate).ToString("d")); var update = ProcessMembershipUpdate(nextMember, message, null, Convert.ToDateTime(nextMember.StartDate).ToString("d"), nextMember.Member.ID, "Member", "StartDate", UpdateAction.Added); membershipUpdates.Add(update); } // Renewal Date if (currentMember.RenewalDate == null && nextMember.RenewalDate != null) { var message = string.Format("Added: Renewal Date {0}", Convert.ToDateTime(nextMember.RenewalDate).ToString("d")); var update = ProcessMembershipUpdate(nextMember, message, null, Convert.ToDateTime(nextMember.RenewalDate).ToString("d"), nextMember.Member.ID, "Member", "RenewalDate", UpdateAction.Added); membershipUpdates.Add(update); } // Status if (currentMember.Status == null && nextMember.Status != null) { var message = string.Format("Added: Status {0}", Enum.GetName(typeof(Status), nextMember.Status)); var update = ProcessMembershipUpdate(nextMember, message, null, Enum.GetName(typeof(Status), nextMember.Status), nextMember.Member.ID, "Member", "Status", UpdateAction.Added); membershipUpdates.Add(update); } } else { // Category if (currentMember.Category.ID != nextMember.Category.ID) { var message = string.Format("Edited: Category changed from {0} to {1}", currentMember.Category.Name, nextMember.Category.Name); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Category.Name, nextMember.Category.Name, nextMember.Member.ID, "Member", "Category", UpdateAction.Edited); membershipUpdates.Add(update); } // Start Date if (currentMember.StartDate != nextMember.StartDate) { var message = string.Format("Edited: Start Date changed from {0} to {1}", Convert.ToDateTime(currentMember.StartDate).ToString("d"), Convert.ToDateTime(nextMember.StartDate).ToString("d")); var update = ProcessMembershipUpdate(nextMember, message, Convert.ToDateTime(currentMember.StartDate).ToString("d"), Convert.ToDateTime(nextMember.StartDate).ToString("d"), nextMember.Member.ID, "Member", "StartDate", UpdateAction.Edited); membershipUpdates.Add(update); } // Renewal Date if (currentMember.RenewalDate != nextMember.RenewalDate) { var message = string.Format("Edited: Renewal Date changed from {0} to {1}", Convert.ToDateTime(currentMember.RenewalDate).ToString("d"), Convert.ToDateTime(nextMember.RenewalDate).ToString("d")); var update = ProcessMembershipUpdate(nextMember, message, Convert.ToDateTime(currentMember.RenewalDate).ToString("d"), Convert.ToDateTime(nextMember.RenewalDate).ToString("d"), nextMember.Member.ID, "Member", "RenewalDate", UpdateAction.Edited); membershipUpdates.Add(update); } // Status if (currentMember.Status != nextMember.Status) { var message = string.Format("Edited: Status changed from {0} to {1}", Enum.GetName(typeof(Status), currentMember.Status), Enum.GetName(typeof(Status), nextMember.Status)); var update = ProcessMembershipUpdate(nextMember, message, Enum.GetName(typeof(Status), currentMember.Status), Enum.GetName(typeof(Status), nextMember.Status), nextMember.Member.ID, "Member", "Status", UpdateAction.Edited); membershipUpdates.Add(update); } // End Date if (nextMember.Member.EndDate != null && currentMember.Member.EndDate == null) { var message = string.Format("Added: End date {0}", Convert.ToDateTime(nextMember.Member.EndDate).ToString("d")); var update = ProcessMembershipUpdate(nextMember, message, null, Convert.ToDateTime(nextMember.Member.EndDate).ToString("d"), nextMember.Member.ID, "Member", "EndDate", UpdateAction.Added); membershipUpdates.Add(update); } else if (nextMember.Member.EndDate == null && currentMember.Member.EndDate != null) { var message = string.Format("Removed: End date {0} removed", Convert.ToDateTime(currentMember.Member.EndDate).ToString("d")); var update = ProcessMembershipUpdate(nextMember, message, Convert.ToDateTime(currentMember.Member.EndDate).ToString("d"), null, nextMember.Member.ID, "Member", "EndDate", UpdateAction.Removed); membershipUpdates.Add(update); } else if (nextMember.Member.EndDate != null && currentMember.Member.EndDate != null && nextMember.Member.EndDate != currentMember.Member.EndDate) { var message = string.Format("Edited: End date changed from {0} to {1}", Convert.ToDateTime(currentMember.Member.EndDate).ToString("d"), Convert.ToDateTime(nextMember.Member.EndDate).ToString("d")); var update = ProcessMembershipUpdate(nextMember, message, Convert.ToDateTime(currentMember.Member.EndDate).ToString("d"), Convert.ToDateTime(nextMember.Member.EndDate).ToString("d"), nextMember.Member.ID, "Member", "EndDate", UpdateAction.Edited); membershipUpdates.Add(update); } // Resign Date if (nextMember.Member.ResignDate != null && currentMember.Member.ResignDate == null) { var message = string.Format("Added: Resign date {0}", Convert.ToDateTime(nextMember.Member.ResignDate).ToString("d")); var update = ProcessMembershipUpdate(nextMember, message, null, Convert.ToDateTime(nextMember.Member.ResignDate).ToString("d"), nextMember.Member.ID, "Member", "ResignDate", UpdateAction.Added); membershipUpdates.Add(update); } else if (nextMember.Member.ResignDate == null && currentMember.Member.ResignDate != null) { var message = string.Format("Removed: Resign date {0} removed", Convert.ToDateTime(currentMember.Member.ResignDate).ToString("d")); var update = ProcessMembershipUpdate(nextMember, message, Convert.ToDateTime(currentMember.Member.ResignDate).ToString("d"), null, nextMember.Member.ID, "Member", "ResignDate", UpdateAction.Removed); membershipUpdates.Add(update); } else if (nextMember.Member.ResignDate != null && currentMember.Member.ResignDate != null && nextMember.Member.ResignDate != currentMember.Member.ResignDate) { var message = string.Format("Edited: Resign date changed from {0} to {1}", Convert.ToDateTime(currentMember.Member.ResignDate).ToString("d"), Convert.ToDateTime(nextMember.Member.ResignDate).ToString("d")); var update = ProcessMembershipUpdate(nextMember, message, Convert.ToDateTime(currentMember.Member.ResignDate).ToString("d"), Convert.ToDateTime(nextMember.Member.ResignDate).ToString("d"), nextMember.Member.ID, "Member", "ResignDate", UpdateAction.Edited); membershipUpdates.Add(update); } // Contact if (nextMember.Contact.Contact.ID == currentMember.Contact.Contact.ID) { ProcessMembershipContact(currentMember, nextMember, membershipUpdates); } else if (nextMember.Contact.Contact.ID != currentMember.Contact.Contact.ID) { var message = string.Format("Edited: Contact changed from {0} to {1}", currentMember.Contact.ContactName, nextMember.Contact.ContactName); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.ContactName, nextMember.Contact.ContactName, nextMember.Member.ID, "Member", "Contact", UpdateAction.Edited); membershipUpdates.Add(update); ProcessMembershipContact(currentMember, nextMember, membershipUpdates); } } } else if (type == "MemberNotes") { // Notes if (currentMember.MemberNotes.Count != nextMember.MemberNotes.Count) { if (nextMember.MemberNotes.Count > currentMember.MemberNotes.Count) { var addedNotes = nextMember.MemberNotes.Except(currentMember.MemberNotes, new MemberNoteComparer()).ToList(); addedNotes.ForEach(memberNote => { var message = string.Format("Added: Note {0}", memberNote.Note); var update = ProcessMembershipUpdate(nextMember, message, null, memberNote.Note, memberNote.MemberNote.ID, "Member Note", "Notes", UpdateAction.Added); membershipUpdates.Add(update); }); } else { var removedNotes = currentMember.MemberNotes.Except(nextMember.MemberNotes, new MemberNoteComparer()).ToList(); removedNotes.ForEach(memberNote => { var message = string.Format("Removed: Note {0}", memberNote.Note); var update = ProcessMembershipUpdate(nextMember, message, memberNote.Note, null, memberNote.MemberNote.ID, "Member Note", "Notes", UpdateAction.Removed); membershipUpdates.Add(update); }); } } foreach (var newNote in nextMember.MemberNotes) { var currentNote = currentMember.MemberNotes.FirstOrDefault(x => x.MemberNote.ID == newNote.MemberNote.ID); if (currentNote == null) continue; if (currentNote.Note != newNote.Note) { var message = string.Format("Edited: Note was changed from {0} to {1}", currentNote.Note, newNote.Note); var update = currentNote.Note != null ? ProcessMembershipUpdate(nextMember, message, currentNote.Note, newNote.Note, newNote.MemberNote.ID, "Member Note", "Notes", UpdateAction.Edited) : ProcessMembershipUpdate(nextMember, message, null, newNote.Note, newNote.MemberNote.ID, "Member Note", "Notes", UpdateAction.Added); membershipUpdates.Add(update); } } } } catch (Exception ex) { } currentMember = null; return membershipUpdates; }
public AddMemberViewModel(MemberModel member) { var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>(); _membershipDataUnit = dataUnitLocator.ResolveDataUnit<IMembershipDataUnit>(); ShowFindContactWindowCommand = new RelayCommand(ShowFindContactWindowCommandExecuted); SaveCommand = new RelayCommand(SaveCommandExecuted, SaveCommandCanExecute); ProcessMember(member); }
private MemberModel GetMember() { var newMember = new MemberModel(new Member { ID = Guid.NewGuid(), }); newMember.Contact = new ContactModel(new Contact { ID = newMember.Member.ID }); return newMember; }
public ContactDetailsView(ContactModel model, bool isFromMembership = false, MemberModel member = null) { InitializeComponent(); DataContext = _viewModel = new ContactDetailsViewModel(model, isFromMembership, member); Loaded += OnContactDetailsViewLoaded; }
public MemberDetailsViewModel(MemberModel model) { var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>(); _membershipDataUnit = dataUnitLocator.ResolveDataUnit<IMembershipDataUnit>(); SaveChangesCommand = new RelayCommand(SaveChangesCommandExecute, SaveChangesCommandCanExecute); CanEdit = AccessService.Current.UserHasPermissions(Resources.PERMISSION_EDIT_MEMBER_ALLOWED); ProcessMember(model); }
private void ProcessMember(MemberModel member) { Member = member; _originalMember = Member.Clone(); Member.PropertyChanged += MemberModelOnPropertyChanged; }
public MemberDetailsView(MemberModel member) { InitializeComponent(); DataContext = _viewModel = new MemberDetailsViewModel(member); Loaded += OnMemberDetailsViewLoaded; }
private string ParseMailMessage(MemberModel member) { var inputText = Message; string outputText; outputText = inputText; if (member.Contact.Title != null) { outputText = outputText .Replace("{#ContactTitle}", member.Contact.Title.Title); } outputText = outputText .Replace("{#ContactFirstName}", member.Contact.FirstName) .Replace("{#ContactLastName}", member.Contact.LastName); outputText = outputText .Replace("{#MemberCategory}", member.Category.Name) .Replace("{#StartDate}", Convert.ToDateTime(member.StartDate).ToString("d")) .Replace("{#MemberReference}", member.Member.MemberReference) .Replace("{#RenewalDate}", Convert.ToDateTime(member.RenewalDate).ToString("d")) .Replace("{#EmailSignature}", AccessService.Current.User.EmailSignature); return outputText; //Correspondence.Message = outputText; //Correspondence.Subject = _selectedMailTemplate.Name; }
private Corresponcence GetCorrespondenceByMember(MemberModel member) { return new Corresponcence() { ID = Guid.NewGuid(), Date = DateTime.Now, OwnerID = member.Member.ID, OwnerType = "Membership", EmailType = "Email", Message = _selectedMailTemplate != null ? ParseMailMessage(member) : Message, Subject = Correspondence.Subject, FromAddress = Correspondence.FromAddress, ToAddress = member.Contact.Email, UserID = AccessService.Current.User.ID, CorresponcenceType = Correspondence.CorresponcenceType, EmailHeader = Correspondence.EmailHeader }; }
private void ProcessMember(MemberModel member) { Member = member; }
public MemberUpdateDetailsViewModel(MemberModel member) { Member = member; var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>(); _membershipDataUnit = dataUnitLocator.ResolveDataUnit<IMembershipDataUnit>(); }
private void ProcessMember(MemberModel member) { _isEditMode = (member != null); Member = member ?? GetMember(); _originalMember = Member.Clone(); Member.PropertyChanged += MemberOnPropertyChanged; Member.Contact.PropertyChanged += Contact_PropertyChanged; }
private static MembershipUpdate ProcessMembershipUpdate(MemberModel memberModel, string message, string oldValue, string newValue, Guid itemID, string itemType, string field, UpdateAction action) { var update = new MembershipUpdate() { ID = Guid.NewGuid(), Date = DateTime.Now, MemberID = memberModel.Member.ID, UserID = AccessService.Current.User.ID, Message = message, OldValue = oldValue, NewValue = newValue, ItemId = itemID, ItemType = itemType, Field = field, Action = Convert.ToInt32(action) }; return update; }
public async Task ShowReleventContact() { var allcontacts = await _membershipDataUnit.ContactsRepository.GetAllAsyncWithoutRefresh(contact => contact.LastName == Member.Contact.LastName && contact.Email == Member.Contact.Email); var contacts = new ObservableCollection<ContactModel>( allcontacts.OrderBy(contact => contact.LastName).Select(contact => new ContactModel(contact))); if (contacts.Count > 0) { RaisePropertyChanged("DisableParentWindow"); var relevantContactsView = new ReleventContactsView(contacts); relevantContactsView.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); if (relevantContactsView.DialogResult != null && relevantContactsView.DialogResult.Value) { if (IsExistingContact) _membershipDataUnit.ContactsRepository.Refresh(Member.Contact.Contact); if (relevantContactsView.ViewModel.Contact.Contact.Member != null) { Member = new MemberModel(relevantContactsView.ViewModel.Contact.Contact.Member) { Contact = relevantContactsView.ViewModel.Contact, Category = MemberCategories.FirstOrDefault(category => category.ID == relevantContactsView.ViewModel.Contact.Contact.Member.MembershipCategory.ID) }; Member.Contact.PropertyChanged += Contact_PropertyChanged; _isEditMode = true; IsExistingMember = true; _originalMember = Member.Clone(); SaveCommand.RaiseCanExecuteChanged(); } else { Member.Contact = relevantContactsView.ViewModel.Contact; Member.Member.ID = Member.Contact.Contact.ID; Member.Contact.PropertyChanged += Contact_PropertyChanged; } IsExistingContact = true; IsIgnored = true; if (IsOkButtonClick) { if (!_isEditMode) SaveContactChangesAddMember(); } } if (relevantContactsView.DialogResult == null || !relevantContactsView.DialogResult.Value) { if (IsOkButtonClick) { _membershipDataUnit.ContactsRepository.Add(Member.Contact.Contact); SaveContactChangesAddMember(); } else IsIgnored = true; } } else { if (IsOkButtonClick) { if (!IsExistingContact) _membershipDataUnit.ContactsRepository.Add(Member.Contact.Contact); SaveContactChangesAddMember(); } } }
private void ShowSelectedContactTabs(MemberModel member) { if (member != null) { _originalMember = member.Clone(); if (CanViewContactDetails) ContactDetailsContent = new ContactDetailsView(member.Contact, true, member); if (CanViewCorrespondence) CorrespondenceContent = new CorrespondenceView(member.Contact,"Member"); if (CanViewActivity) ActivityContent = new ActivityView(member.Contact); if (CanViewAccounts) AccountsContent = new AccountsView(member.Contact); if (CanViewMemberDetails) MemberDetailsContent = new MemberDetailsView(member); if (CanViewNoteDetails) MemberNotesContent = new MemberNotesView(member); if (CanViewUpdateDetails) MemberUpdateDetailsContent = new MemberUpdateDetailsView(member); } }
private void ProcessUpdates(MemberModel member, List<MembershipUpdate> membershipUpdates) { membershipUpdates.ForEach(update => { member.MembershipUpdates.Insert(0, update); _membershipDataUnit.MembershipUpdatesRepository.Add(update); }); member.MembershipUpdates = new ObservableCollection<MembershipUpdate>(member.MembershipUpdates.OrderByDescending(x => x.Date)); }
private static void ProcessMembershipContact(MemberModel currentMember, MemberModel nextMember, List<MembershipUpdate> membershipUpdates) { if (currentMember.Contact.Title == null && nextMember.Contact.Title != null) { var message = string.Format("Edited: Added Title {0}", nextMember.Contact.Title.Title); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.Title.Title, nextMember.Member.Contact.ID, "Contact", "Title", UpdateAction.Added); membershipUpdates.Add(update); } else if (nextMember.Contact.Title != null && currentMember.Contact.Title != null && currentMember.Contact.Title.ID != nextMember.Contact.Title.ID) { var message = string.Format("Edited: Title changed from {0} to {1}", currentMember.Contact.Title.Title, nextMember.Contact.Title.Title); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Title.Title, nextMember.Contact.Title.Title, nextMember.Member.Contact.ID, "Contact", "Title", UpdateAction.Edited); membershipUpdates.Add(update); } if (nextMember.Contact.FirstName != currentMember.Contact.FirstName) { var message = string.Format("Edited: First name changed from {0} to {1}", currentMember.Contact.FirstName, nextMember.Contact.FirstName); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.FirstName, nextMember.Contact.FirstName, nextMember.Member.Contact.ID, "Contact", "FirstName", UpdateAction.Edited); membershipUpdates.Add(update); } if (nextMember.Contact.LastName != currentMember.Contact.LastName) { var message = string.Format("Edited: Last name changed from {0} to {1}", currentMember.Contact.LastName, nextMember.Contact.LastName); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.LastName, nextMember.Contact.LastName, nextMember.Member.Contact.ID, "Contact", "LastName", UpdateAction.Edited); membershipUpdates.Add(update); } if (string.IsNullOrEmpty(currentMember.Contact.Email) && !string.IsNullOrEmpty(nextMember.Contact.Email)) { var message = string.Format("Edited: Added Email {0}", nextMember.Contact.Email); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.Email, nextMember.Member.Contact.ID, "Contact", "Email", UpdateAction.Added); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(currentMember.Contact.Email) && string.IsNullOrEmpty(nextMember.Contact.Email)) { var message = string.Format("Edited: Email removed {0}", currentMember.Contact.Email); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Email, null, nextMember.Member.Contact.ID, "Contact", "Email", UpdateAction.Removed); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(nextMember.Contact.Email) && !string.IsNullOrEmpty(currentMember.Contact.Email) && nextMember.Contact.Email != currentMember.Contact.Email) { var message = string.Format("Edited: Email changed from {0} to {1}", currentMember.Contact.Email, nextMember.Contact.Email); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Email, nextMember.Contact.Email, nextMember.Member.Contact.ID, "Contact", "Email", UpdateAction.Edited); membershipUpdates.Add(update); } if (nextMember.Contact.Gender != currentMember.Contact.Gender) { var message = string.Format("Edited: Gender changed from {0} to {1}", Enum.GetName(typeof(Gender), currentMember.Contact.Gender), nextMember.Contact.Gender); var update = ProcessMembershipUpdate(nextMember, message, Enum.GetName(typeof(Gender), currentMember.Contact.Gender), Enum.GetName(typeof(Gender), nextMember.Contact.Gender), nextMember.Member.Contact.ID, "Contact", "Gender", UpdateAction.Edited); membershipUpdates.Add(update); } if (string.IsNullOrEmpty(currentMember.Contact.Address1) && !string.IsNullOrEmpty(nextMember.Contact.Address1)) { var message = string.Format("Edited: Added Address1 {0}", nextMember.Contact.Address1); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.Address1, nextMember.Member.Contact.ID, "Contact", "Address1", UpdateAction.Added); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(currentMember.Contact.Address1) && string.IsNullOrEmpty(nextMember.Contact.Address1)) { var message = string.Format("Edited: Address1 removed {0}", currentMember.Contact.Address1); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Address1, null, nextMember.Member.Contact.ID, "Contact", "Address1", UpdateAction.Removed); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(nextMember.Contact.Address1) && !string.IsNullOrEmpty(currentMember.Contact.Address1) && nextMember.Contact.Address1 != currentMember.Contact.Address1) { var message = string.Format("Edited: Address1 changed from {0} to {1}", currentMember.Contact.Address1, nextMember.Contact.Address1); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Address1, nextMember.Contact.Address1, nextMember.Member.Contact.ID, "Contact", "Address1", UpdateAction.Edited); membershipUpdates.Add(update); } if (string.IsNullOrEmpty(currentMember.Contact.Address2) && !string.IsNullOrEmpty(nextMember.Contact.Address2)) { var message = string.Format("Edited: Added Address2 {0}", nextMember.Contact.Address2); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.Address2, nextMember.Member.Contact.ID, "Contact", "Address2", UpdateAction.Added); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(currentMember.Contact.Address2) && string.IsNullOrEmpty(nextMember.Contact.Address2)) { var message = string.Format("Edited: Address2 removed {0}", currentMember.Contact.Address2); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Address2, null, nextMember.Member.Contact.ID, "Contact", "Address2", UpdateAction.Removed); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(nextMember.Contact.Address2) && !string.IsNullOrEmpty(currentMember.Contact.Address2) && nextMember.Contact.Address2 != currentMember.Contact.Address2) { var message = string.Format("Edited: Address2 changed from {0} to {1}", currentMember.Contact.Address2, nextMember.Contact.Address2); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Address2, nextMember.Contact.Address2, nextMember.Member.Contact.ID, "Contact", "Address2", UpdateAction.Edited); membershipUpdates.Add(update); } if (string.IsNullOrEmpty(currentMember.Contact.Address3) && !string.IsNullOrEmpty(nextMember.Contact.Address3)) { var message = string.Format("Edited: Added Address3 {0}", nextMember.Contact.Address3); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.Address3, nextMember.Member.Contact.ID, "Contact", "Address3", UpdateAction.Added); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(currentMember.Contact.Address3) && string.IsNullOrEmpty(nextMember.Contact.Address3)) { var message = string.Format("Edited: Address3 removed {0}", currentMember.Contact.Address3); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Address3, null, nextMember.Member.Contact.ID, "Contact", "Address3", UpdateAction.Removed); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(nextMember.Contact.Address3) && !string.IsNullOrEmpty(currentMember.Contact.Address3) && nextMember.Contact.Address3 != currentMember.Contact.Address3) { var message = string.Format("Edited: Address3 changed from {0} to {1}", currentMember.Contact.Address3, nextMember.Contact.Address3); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Address3, nextMember.Contact.Address3, nextMember.Member.Contact.ID, "Contact", "Address3", UpdateAction.Edited); membershipUpdates.Add(update); } if (string.IsNullOrEmpty(currentMember.Contact.CompanyName) && !string.IsNullOrEmpty(nextMember.Contact.CompanyName)) { var message = string.Format("Edited: Added Company {0}", nextMember.Contact.CompanyName); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.CompanyName, nextMember.Member.Contact.ID, "Contact", "CompanyName", UpdateAction.Added); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(currentMember.Contact.CompanyName) && string.IsNullOrEmpty(currentMember.Contact.CompanyName)) { var message = string.Format("Edited: Company removed {0}", currentMember.Contact.CompanyName); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.CompanyName, null, nextMember.Member.Contact.ID, "Contact", "CompanyName", UpdateAction.Removed); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(nextMember.Contact.CompanyName) && !string.IsNullOrEmpty(currentMember.Contact.CompanyName) && nextMember.Contact.CompanyName != currentMember.Contact.CompanyName) { var message = string.Format("Edited: Company changed from {0} to {1}", currentMember.Contact.CompanyName, nextMember.Contact.CompanyName); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.CompanyName, nextMember.Contact.CompanyName, nextMember.Member.Contact.ID, "Contact", "CompanyName", UpdateAction.Edited); membershipUpdates.Add(update); } if (string.IsNullOrEmpty(currentMember.Contact.City) && !string.IsNullOrEmpty(nextMember.Contact.City)) { var message = string.Format("Edited: Added City {0}", nextMember.Contact.City); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.City, nextMember.Member.Contact.ID, "Contact", "City", UpdateAction.Added); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(currentMember.Contact.City) && string.IsNullOrEmpty(nextMember.Contact.City)) { var message = string.Format("Edited: City removed {0}", currentMember.Contact.City); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.City, null, nextMember.Member.Contact.ID, "Contact", "City", UpdateAction.Removed); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(nextMember.Contact.City) && !string.IsNullOrEmpty(currentMember.Contact.City) && nextMember.Contact.City != currentMember.Contact.City) { var message = string.Format("Edited: City changed from {0} to {1}", currentMember.Contact.City, nextMember.Contact.City); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.City, nextMember.Contact.City, nextMember.Member.Contact.ID, "Contact", "City", UpdateAction.Edited); membershipUpdates.Add(update); } if (string.IsNullOrEmpty(currentMember.Contact.Country) && !string.IsNullOrEmpty(nextMember.Contact.Country)) { var message = string.Format("Edited: Added Country {0}", nextMember.Contact.Country); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.Country, nextMember.Member.Contact.ID, "Contact", "Country", UpdateAction.Added); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(currentMember.Contact.Country) && string.IsNullOrEmpty(nextMember.Contact.Country)) { var message = string.Format("Edited: Country removed {0}", currentMember.Contact.Country); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Country, null, nextMember.Member.Contact.ID, "Contact", "Country", UpdateAction.Removed); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(nextMember.Contact.Country) && !string.IsNullOrEmpty(currentMember.Contact.Country) && nextMember.Contact.Country != currentMember.Contact.Country) { var message = string.Format("Edited: Country changed from {0} to {1}", currentMember.Contact.Country, nextMember.Contact.Country); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Country, nextMember.Contact.Country, nextMember.Member.Contact.ID, "Contact", "Country", UpdateAction.Edited); membershipUpdates.Add(update); } if (string.IsNullOrEmpty(currentMember.Contact.PostCode) && !string.IsNullOrEmpty(nextMember.Contact.PostCode)) { var message = string.Format("Edited: Added PostCode {0}", nextMember.Contact.PostCode); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.PostCode, nextMember.Member.Contact.ID, "Contact", "PostCode", UpdateAction.Added); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(currentMember.Contact.PostCode) && string.IsNullOrEmpty(nextMember.Contact.PostCode)) { var message = string.Format("Edited: PostCode removed {0}", currentMember.Contact.PostCode); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.PostCode, null, nextMember.Member.Contact.ID, "Contact", "PostCode", UpdateAction.Removed); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(nextMember.Contact.PostCode) && !string.IsNullOrEmpty(currentMember.Contact.PostCode) && nextMember.Contact.PostCode != currentMember.Contact.PostCode) { var message = string.Format("Edited: PostCode changed from {0} to {1}", currentMember.Contact.PostCode, nextMember.Contact.PostCode); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.PostCode, nextMember.Contact.PostCode, nextMember.Member.Contact.ID, "Contact", "PostCode", UpdateAction.Edited); membershipUpdates.Add(update); } if (string.IsNullOrEmpty(currentMember.Contact.Phone1) && !string.IsNullOrEmpty(nextMember.Contact.Phone1)) { var message = string.Format("Edited: Added Phone1 {0}", nextMember.Contact.Phone1); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.Phone1, nextMember.Member.Contact.ID, "Contact", "Phone1", UpdateAction.Added); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(currentMember.Contact.Phone1) && string.IsNullOrEmpty(nextMember.Contact.Phone1)) { var message = string.Format("Edited: Phone1 removed {0}", currentMember.Contact.Phone1); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Phone1, null, nextMember.Member.Contact.ID, "Contact", "Phone1", UpdateAction.Removed); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(nextMember.Contact.Phone1) && !string.IsNullOrEmpty(currentMember.Contact.Phone1) && nextMember.Contact.Phone1 != currentMember.Contact.Phone1) { var message = string.Format("Edited: Phone1 changed from {0} to {1}", currentMember.Contact.Phone1, nextMember.Contact.Phone1); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Phone1, nextMember.Contact.Phone1, nextMember.Member.Contact.ID, "Contact", "Phone1", UpdateAction.Edited); membershipUpdates.Add(update); } if (string.IsNullOrEmpty(currentMember.Contact.Phone2) && !string.IsNullOrEmpty(nextMember.Contact.Phone2)) { var message = string.Format("Edited: Added Phone2 {0}", nextMember.Contact.Phone2); var update = ProcessMembershipUpdate(nextMember, message, null, nextMember.Contact.Phone2, nextMember.Member.Contact.ID, "Contact", "Phone2", UpdateAction.Added); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(currentMember.Contact.Phone2) && string.IsNullOrEmpty(nextMember.Contact.Phone2)) { var message = string.Format("Edited: Phone2 removed {0}", currentMember.Contact.Phone2); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Phone2, null, nextMember.Member.Contact.ID, "Contact", "Phone2", UpdateAction.Removed); membershipUpdates.Add(update); } else if (!string.IsNullOrEmpty(nextMember.Contact.Phone2) && !string.IsNullOrEmpty(currentMember.Contact.Phone2) && nextMember.Contact.Phone2 != currentMember.Contact.Phone2) { var message = string.Format("Edited: Phone2 changed from {0} to {1}", currentMember.Contact.Phone2, nextMember.Contact.Phone2); var update = ProcessMembershipUpdate(nextMember, message, currentMember.Contact.Phone2, nextMember.Contact.Phone2, nextMember.Member.Contact.ID, "Contact", "Phone2", UpdateAction.Edited); membershipUpdates.Add(update); } }