public virtual void ChangeManyAddressees(Sungero.Domain.Client.ExecuteActionArgs e) { if (_obj.IsManyAddressees == false) { Dialogs.NotifyMessage(OutgoingDocumentBases.Resources.FillDistributionListOnAdressesTab); } if (_obj.IsManyAddressees == true && _obj.Addressees.Count(a => a.Correspondent != null) > 1) { var addresseeRaw = _obj.Addressees.OrderBy(a => a.Number).FirstOrDefault(a => a.Correspondent != null); var addresseeName = string.Empty; var correspondentName = addresseeRaw.Correspondent.Name; if (addresseeRaw.Addressee != null) { if (addresseeRaw.Addressee.Person != null) { var person = addresseeRaw.Addressee.Person; addresseeName = Parties.PublicFunctions.Person.GetSurnameAndInitialsInTenantCulture(person.FirstName, person.MiddleName, person.LastName); } else { var contactName = CaseConverter.SplitPersonFullName(addresseeRaw.Addressee.Name); addresseeName = Parties.PublicFunctions.Person.GetSurnameAndInitialsInTenantCulture(contactName.FirstName, contactName.MiddleName, contactName.LastName); } addresseeName = string.Format("{0} ({1})", addresseeName, correspondentName); } else { addresseeName = correspondentName; } var dialog = Dialogs.CreateTaskDialog(OutgoingDocumentBases.Resources.ChangeManyAddresseesQuestion, OutgoingDocumentBases.Resources.ChangeManyAddresseesDescriptionFormat(addresseeName), MessageType.Question); dialog.Buttons.AddYesNo(); if (dialog.Show() == DialogButtons.Yes) { _obj.IsManyAddressees = !_obj.IsManyAddressees; } } else { _obj.IsManyAddressees = !_obj.IsManyAddressees; } }