Пример #1
0
        public void CreateEmailAlert(long userId, Dictionary <string, string> values)
        {
            var user                = Users.Include("Contact").Where(p => p.UserId == userId).Single();
            var emailTo             = user.Contact.Email;
            var subjectTemplateCode = values["TMP_SUBJECT"];
            var bodyTemplateCode    = values["TMP_BODY"];


            var subjectTemplate = Templates.Where(p => p.Name == subjectTemplateCode && p.Deleted == false).Single().Value;
            var bodyTemplate    = Templates.Where(p => p.Name == bodyTemplateCode && p.Deleted == false).Single().Value;

            Email email = new Email();

            email.FromAddress       = values["EMAIL_FROM_ADDRESS"];
            email.FromName          = values["EMAIL_FROM_NAME"];
            email.Subject           = MergeTemplateValues(subjectTemplate, values);
            email.IsHtml            = true;
            email.Body              = MergeTemplateValues(bodyTemplate, values);
            email.EmailStatusTypeId = EmailStatusTypes.Where(p => p.Name == "Created").Single().EmailStatusTypeId;
            Emails.Add(email);
            EmailTo to = new EmailTo();

            to.Email   = email;
            to.Name    = $"{user.Contact.FirstName} {user.Contact.LastName}";
            to.Address = emailTo;
            EmailTos.Add(to);
        }
 public override void RegisterMessenger()
 {
     MessengerInstance.Register <Address>(this, MSG_PERSON_ADD_ADDRESS, (address) =>
     {
         Addresses.Add(address);
     });
     MessengerInstance.Register <ContactMethod>(this, MSG_PERSON_ADD_CONTACT, (contact) =>
     {
         Contacts.Add(contact);
     });
     MessengerInstance.Register <Email>(this, MSG_PERSON_ADD_EMAIL, (email) =>
     {
         Emails.Add(email);
     });
     MessengerInstance.Register <Address>(this, MSG_PERSON_DEL_ADDRESS, (address) =>
     {
         Addresses.Remove(address);
     });
     MessengerInstance.Register <ContactMethod>(this, MSG_PERSON_DEL_CONTACT, (contact) =>
     {
         Contacts.Remove(contact);
     });
     MessengerInstance.Register <Email>(this, MSG_PERSON_DEL_EMAIL, (email) =>
     {
         Emails.Remove(email);
     });
 }
Пример #3
0
        private void AddEntity(object param)
        {
            int paramValue = GetParam(param);

            switch (paramValue)
            {
            case 0:
                Contacts.Add(new Contact {
                    ModelStateChanged = true
                });
                break;

            case 1:
                Emails.Add(new EmailAddress {
                    ModelStateChanged = true
                });
                break;

            case 2:
                Phones.Add(new PhoneNumber {
                    ModelStateChanged = true
                });
                break;

            case 3:
                Mails.Add(new MailingAddress {
                    ModelStateChanged = true
                });
                break;

            default:
                break;
            }
        }
Пример #4
0
        public EmailAddress AddEmail(string value)
        {
            // email may already exist
            var email = Emails.ByValue(value);

            if (email != null)
            {
                return(email);
            }

            // create email
            email = new EmailAddress
            {
                // if person does not already have a default email, this is it
                IsDefault = (Emails.Count(a => a.IsDefault) == 0),
                Value     = value,
                Person    = this,
                Number    = Emails.NextNumber(),
            };

            // add & return email
            Emails.Add(email);

            return(email);
        }
Пример #5
0
        private void UpdateContacts(Slot slot, string stringValue)
        {
            if (slot.Value is UriReferent uriReferent)
            {
                switch (uriReferent.Scheme)
                {
                case "mailto":
                    Emails.Add(uriReferent.Value);
                    break;

                case "http":
                case "https":
                {
                    if (Company == null)
                    {
                        Company = new CompanyReferent();
                    }

                    Company.Site = stringValue;
                    Site         = stringValue;
                    break;
                }
                }
            }

            if (slot.Value is EP.Ner.Phone.PhoneReferent phoneReferent)
            {
                Phones.Add(new PhoneReferent(phoneReferent));
            }

            if (slot.Value is AddressReferent addressReferent)
            {
                UpdateDescription($"Адрес: {addressReferent}");
            }
        }
Пример #6
0
 private void AddEmailsTail(int count)
 {
     for (var i = 0; i < count; i++)
     {
         Emails.Add(CreateEmail());
     }
 }
        public void AddEmployeeForm_AddEmail(object e)
        {
            var newEmail = new EmailModel();

            newEmail.Address = _newEmailAddress;
            newEmail.Type    = _newEmailType;
            Emails.Add(newEmail);
        }
Пример #8
0
 private void GetEmails()
 {
     Emails.Clear();
     foreach (var item in _serviceProxy.GetEmails())
     {
         Emails.Add(item);
     }
 }
Пример #9
0
 public void AdicionarEmail(EEmailTipo tipo, string endereco)
 {
     if (Emails.Any(e => e.Endereco == endereco))
     {
         throw new Email.JaExisteException();
     }
     Emails.Add(new Email(tipo, endereco));
 }
Пример #10
0
        private async void ShowFolder()
        {
            var folder = Folders[SelectedFolderIndex];

            if (folder == null)
            {
                return;
            }
            Emails.Clear();
            using (var client = new ImapClient())
            {
                await client.ConnectAsync("imap.gmail.com", 993, true);

                client.AuthenticationMechanisms.Remove("XOAUTH2");
                client.Authenticate("ece433tester", "thisclassman");
                IMailFolder fold;
                if (folder.Name == "INBOX")
                {
                    fold = client.Inbox;
                    await fold.OpenAsync(FolderAccess.ReadOnly);

                    for (int i = 0; i < fold.Count; i++)
                    {
                        try
                        {
                            var email = fold.GetMessage(i);
                            Emails.Add(email);
                        }
                        catch (Exception)
                        {
                            throw;
                        }
                    }
                }
                else
                {
                    if ((client.Capabilities & (ImapCapabilities.SpecialUse | ImapCapabilities.XList)) != 0)
                    {
                        fold = client.GetFolder(folderTypes[SelectedFolderIndex - 1]);
                        await fold.OpenAsync(FolderAccess.ReadOnly);

                        for (int i = 0; i < fold.Count; i++)
                        {
                            try
                            {
                                var email = fold.GetMessage(i);
                                Emails.Add(email);
                            }
                            catch (Exception)
                            {
                                throw;
                            }
                        }
                    }
                }
                client.Disconnect(true);
            }
        }
Пример #11
0
 private void GetEmails()
 {
     Emails.Clear();
     foreach (var item in _serviceProxy.GetEmails())
     {
         Emails.Add(item);
     }
     Console.WriteLine(55);
 }
Пример #12
0
 private void SaveEmail(Email email)
 {
     EmailInfo.Id = this.serviceProxy.CreateEmail(email);
     if (EmailInfo.Id != 0)
     {
         Emails.Add(EmailInfo);
         RaisePropertyChanged(nameof(EmailInfo));
     }
 }
 public User AddMail(Email email)
 {
     if (Emails.Any(x => x.Value == email.Value))
     {
         throw new BusinessException("Email is already exist!");
     }
     Emails.Add(email);
     return(this);
 }
Пример #14
0
 public async void GetUsers()
 {
     foreach (var users in await Data.User.GetAllAsync())
     {
         Usernames.Add(users.UserName.Trim());
         StudentNumbers.Add(users.StudentNumber.Trim());
         Emails.Add(users.EmailAdress.Trim());
     }
 }
Пример #15
0
 void IDataExchange.CreateActivelyLookingNotification(Guid candidateId)
 {
     if (candidateId == Guid.Empty)
     {
         throw new ArgumentException("Candidate ID is empty. Check that it is properly bound.");
     }
     UserId = candidateId;
     Emails.Add(MockEmail.LookingNotification);
 }
Пример #16
0
        public async void LoadLastEmailsAsync(int cnt)
        {
            List <EmailModel> emails = await IoC.Get <AppViewModel>().MailClient.GetLastEmailsAsync(cnt);

            foreach (EmailModel email in emails)
            {
                Emails.Add(email);
            }
        }
Пример #17
0
 void IDataExchange.CreateAvailableNowConfirmationRequest(Guid candidateId)
 {
     if (candidateId == Guid.Empty)
     {
         throw new ArgumentException("Candidate ID is empty. Check that it is properly bound.");
     }
     UserId = candidateId;
     Emails.Add(MockEmail.ConfirmAvailableRequest);
 }
 public void Load(IContentViewModel contentViewModel)
 {
     foreach (var email in _navigationDataProvider.GetEmails())
     {
         Emails.Add(
             new EmailViewModel(
                 email,
                 contentViewModel));
     }
 }
Пример #19
0
        public async void GetAllEmails()
        {
            var emails = await _emailSupplier.GetAllAsync();

            Emails.Clear();
            foreach (Email email in emails)
            {
                Emails.Add(new EmailObservable(email));
            }
        }
Пример #20
0
 private void FillEmails(IEnumerable <Email> emails)
 {
     if (emails != null)
     {
         foreach (var item in emails)
         {
             Emails.Add(new EmailViewModel(item));
         }
     }
 }
Пример #21
0
 private void AddItems()
 {
     for (int i = 0; i < new Random().Next(100); i++)
     {
         Emails.Add(new Email
         {
             From = "From" + i, To = "To" + i, Subject = "Subject" + i, Body = "Body" + i, IsChecked = false
         });
     }
 }
Пример #22
0
 public void LoadEmails()
 {
     using (SqlCommand command = new SqlCommand("select * from Emails where Contact_id = @Contact_id"))
     {
         command.Parameters.Add(DataContext.CreateSqlParameter("@Contact_id", Id));
         DataTable dt = DataContext.ExecuteReader(command);
         foreach (DataRow row in dt.Rows)
         {
             Emails.Add(new Email(row));
         }
     }
 }
Пример #23
0
 public string[] GetEmails()
 {
     if (Title.HasEmail())
     {
         Emails = Title.GetEmails().ToList();
     }
     if (Content.HasEmail())
     {
         Emails.AddRange(Content.GetEmails().ToList());
     }
     Emails.Add(CreatedBy);
     return(Emails.Distinct().ToArray());
 }
Пример #24
0
 private void OnEmailReceived(EmailModel email)
 {
     App.Current.Dispatcher.Invoke((Action) delegate
     {
         Emails.Add(new EmailEnvelopeItem()
         {
             Id      = email.Id,
             From    = email.Header.From[0],
             Subject = email.Header.Subject,
             Date    = email.Header.Date
         });
     });
 }
Пример #25
0
 public void AjouterTeleOuMail(Telephone tele, Email mail, bool?a)
 {
     // ajout Telephone
     if (a == true)
     {
         Telephones.Add(tele);
         SaveChanges();
     }
     // ajout email
     else
     {
         Emails.Add(mail);
         SaveChanges();
     }
 }
Пример #26
0
        public void ConfirmEmail(Email email)
        {
            var exist = Emails.Any(item => item.Equals(email));

            if (exist)
            {
                Emails.Remove(email);
                Emails.Add(email);
            }
            else
            {
                throw new InvalidOperationException("Email not exist");
            }

            PendingEvents.Enqueue(new EmailWasConfirmed(AggregatedId, new { Email = email }));
        }
Пример #27
0
        public MainPage()
        {
            this.InitializeComponent();

            Binding myBinding = new Binding()
            {
                Source = Emails,
                Mode   = BindingMode.OneWay
            };

            MyMasterDetailsView.SetBinding(MasterDetailsView.ItemsSourceProperty, myBinding);

            var emails = MyEmailManager.GetEmails();

            emails.ForEach(email => Emails.Add(email));
        }
Пример #28
0
        void LoadEmails()
        {
            var content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum fermentum facilisis libero, venenatis mattis orci hendrerit eget. Etiam ultrices mollis justo, nec fermentum elit viverra eu. Cras at cursus turpis. Nullam magna sem, vulputate quis massa nec, mollis sollicitudin dui. Sed eu massa in arcu pharetra posuere. Phasellus maximus neque non ex dapibus fringilla. Praesent nec lacinia enim. Curabitur a dui nisl.";

            Emails.Add(new EmailBox {
                Img = "Assets/user02.png", Name = "Sam Miller", Subject = "Portifolio", EmailDate = "Today", EmailHour = "08:45 PM", Attachments = 4, AttachmentsItems = LoadAttachments(), Email = "*****@*****.**", Content = content
            });
            Emails.Add(new EmailBox {
                Img = "Assets/user03.png", Name = "Lily Jones", Subject = "Invitations", EmailDate = "Yesterday", EmailHour = "01:11 PM", Attachments = 0, Email = "*****@*****.**", Content = content
            });
            Emails.Add(new EmailBox {
                Img = "Assets/user04.png", Name = "Smith", Subject = "Assigment Submission", EmailDate = "Monday", EmailHour = "06:45 PM", Attachments = 0, Email = "*****@*****.**", Content = content
            });
            Emails.Add(new EmailBox {
                Img = "Assets/user05.png", Name = "Patrick", Subject = "Interview Scheduled", EmailDate = "Monday", EmailHour = "05:15 PM", Attachments = 0, Email = "*****@*****.**", Content = content
            });
        }
Пример #29
0
 void OnFolderContentsChanged(object sender, EmailFolderChangeEventArgs args)
 {
     if (args.ChangeType == EmailFolderChangeType.Added)
     {
         dispatcherService.Dispatch(() =>
         {
             Emails.Add(new MailViewModel(args.Email, emailService));
         });
     }
     else
     {
         dispatcherService.Dispatch(() =>
         {
             Emails.Remove(Emails.Where(e => e.Email.Id == args.Email.Id).Single());
         });
     }
 }
Пример #30
0
        private void SaveEmail(Email email)
        {
            try
            {
                EmailInfo.Id = _serviceProxy.AddEmail(email);
                if (EmailInfo.Id != 0)
                {
                    Emails.Add(EmailInfo);
                    RaisePropertyChanged(nameof(EmailInfo));

                    MainWindow mw = new MainWindow();

                    mw.Reload();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Данный Айди нельзя использовать");
            }
        }