public void send(ReceivedEmailDto email_detail, string email_password, string email_host, string email_port)
        {
            try
            {
                using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required))
                {
                    try
                    {
                        sendEmail(email_detail, email_password, email_host, email_port);
                    }
                    catch (Exception ex)
                    {
                        throw new EmailSendFailureException(ex.Message);
                    }


                    ReceivedEmail receivedEmail = new ReceivedEmail();
                    _receivedEmailMaker.copy(ref receivedEmail, email_detail);

                    _receivedEmailRepo.insert(receivedEmail);
                    tx.Complete();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 public void copy(ref ReceivedEmail received_email, ReceivedEmailDto received_email_dto)
 {
     received_email.subject      = received_email_dto.subject.Trim();
     received_email.sender_email = received_email_dto.sender_email.Trim();
     received_email.first_name   = received_email_dto.first_name.Trim();
     received_email.last_name    = received_email_dto.last_name.Trim();
     received_email.message      = received_email_dto.message.Trim();
 }
Exemplo n.º 3
0
 public EmailView(ReceivedEmail email, MainViewModel mvm)
 {
     InitializeComponent();
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     _mvm = mvm;
     _emailId.Add(email.Uid);;
     emailSender.Text  = email.EmailAddress;
     emailSubject.Text = email.Subject;
     emailBody.Text    = email.Body;
 }
Exemplo n.º 4
0
        public async Task <bool> MarkNotReviewedAsync(ReceivedEmail receivedEmail, CancellationToken cancellationToken)
        {
            var existingEmail = await this.context.ReceivedEmails.SingleOrDefaultAsync(email => email.Id.Equals(receivedEmail.Id), cancellationToken);

            if (existingEmail != null)
            {
                existingEmail.EmailStatusId = -1;

                this.context.ReceivedEmails.Update(existingEmail);
                await this.context.SaveChangesAsync(cancellationToken);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        public async Task <bool> MarkInvalidAsync(ReceivedEmail receivedEmail, CancellationToken cancellationToken)
        {
            var existingEmail = await this.context.ReceivedEmails.SingleOrDefaultAsync(email => email.Id.Equals(receivedEmail.Id), cancellationToken);

            if (existingEmail != null)
            {
                existingEmail.EmailStatusId = -3;
                existingEmail.DeletedOn     = DateTime.UtcNow.AddHours(2);

                this.context.ReceivedEmails.Update(existingEmail);
                await this.context.SaveChangesAsync(cancellationToken);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 6
0
 public static EmailViewModel ToViewModel(this ReceivedEmail entity)
 {
     return(entity != null ? new EmailViewModel
     {
         Id = entity.Id,
         Body = entity.Body,
         Subject = entity.Subject,
         SenderEmail = entity.SenderEmail,
         SenderName = entity.SenderName,
         GmailEmailId = entity.GmailEmailId,
         DateReceived = entity.DateReceived,
         ApplicantId = entity.ApplicantId,
         EmailStatusId = entity.EmailStatusId,
         CreatedOn = entity.CreatedOn,
         ModifiedOn = entity.ModifiedOn,
         DeletedOn = entity.DeletedOn,
         IsDeleted = entity.IsDeleted,
         TotalAttachments = entity.TotalAttachments,
         AttachmentsTotalSizeInMB = entity.AttachmentsTotalSizeInMB
     } : null);
 }
Exemplo n.º 7
0
    private void CreateReceivedEmailButtonFor(ReceivedEmail email)
    {
        GameObject emailButton = Instantiate(emailButtonPrefab, incomingMailObject.transform, false);

        emailButton.transform.Translate(new Vector3(0, emailButtonsYOffset * receivedEmailButtons.Count, 0));
        receivedEmailButtons.Add(emailButton);
        emailButton.GetComponentInChildren <Text>().text = "Message " + receivedEmailButtons.Count;
        emailButton.SetActive(true);

        emailButton.GetComponent <Button>().onClick.AddListener(() =>
        {
            emailSubject.GetComponent <Text>().text = email.subject;
            emailText.GetComponent <Text>().text    = email.text;
        });
        if (email.contract)
        {
            emailButton.GetComponent <Button>().onClick.AddListener(() =>
            {
                blueprintButton.GetComponent <Button>().interactable = true;
            });
        }
    }