Exemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Window       w  = new Window();
            AddRecipient ar = new AddRecipient();

            w.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            w.WindowStyle           = WindowStyle.ToolWindow;
            w.SizeToContent         = SizeToContent.WidthAndHeight;
            w.Content = ar;
            if (w.ShowDialog() == true)
            {
                Recipients.Add(ar.Recipient);
            }
        }
Exemplo n.º 2
0
        public void Handle(AddRecipientsSelections command)
        {
            List <Recipient> recipients = new List <Recipient>();
            List <Selection> selections = new List <Selection>();

            _validator.ToList().ForEach(x => x.Validate(command));
            foreach (var recipient in command.RecipientEmails)
            {
                if (!_recipientRepository.Exists(recipient))
                {
                    var newRecipient = new AddRecipient(recipient);
                    _commandHandlerDispatcher.Execute(newRecipient);
                    _unitOfWork.CommitChanges();
                }
                recipients.Add(_recipientRepository.Get(recipient));
            }

            foreach (var selection in command.SheetSelections)
            {
                var sheetName     = RegexUtils.GetSheetNameFromSelectionString(selection);
                var selectionName = RegexUtils.GetSelectionNameFromSelectionString(selection);
                if (!_selectionRepository.Exists(sheetName, selectionName))
                {
                    var newSelection = new AddSelection(sheetName, selectionName);
                    _commandHandlerDispatcher.Execute(newSelection);
                    _unitOfWork.CommitChanges();
                }
                selections.Add(_selectionRepository.Get(sheetName, selectionName));
            }

            foreach (var recipientEntity in recipients)
            {
                foreach (var selectionEntity in selections)
                {
                    if (!_sharingRepository.Exists(recipientEntity.ID, selectionEntity.ID))
                    {
                        var newSharing = new AddSharing(recipientEntity.ID, selectionEntity.ID);
                        _commandHandlerDispatcher.Execute(newSharing);
                        _unitOfWork.CommitChanges();
                    }
                }
            }
        }
Exemplo n.º 3
0
        public virtual async Task <AddRecipientResponse> addRecipientAsync(AddRecipient contact)
        {
            if (contact == null)
            {
                throw new ArgumentNullException("contact");
            }

            var encodedRecipient = _addRecipientEncoder.Encode(contact);

            string response;

            using (var silverpop = _silverpopFactory())
            {
                response = await silverpop.HttpUploadAsync(encodedRecipient, true, true, XMLAPISession).ConfigureAwait(false);
            }

            var decodedResponse = _addRecipientDecoder.Decode(response);

            return(decodedResponse);
        }
Exemplo n.º 4
0
        public virtual AddRecipientResponse AddRecipient(AddRecipient contact)
        {
            if (contact == null)
            {
                throw new ArgumentNullException("contact");
            }

            var encodedRecipient = _addRecipientEncoder.Encode(contact);

            string response;

            using (var silverpop = _silverpopFactory())
            {
                response = silverpop.HttpUpload(encodedRecipient, true, true, XMLAPISession);
            }

            var decodedResponse = _addRecipientDecoder.Decode(response);

            return(decodedResponse);
        }