Beispiel #1
0
 public EmailService(UserEmailInformation emailInfo, IEmailMessage messageInfo)
 {
     this.emailAddress = emailInfo.emailAddress;
     this.name         = emailInfo.name;
     this.subject      = messageInfo.subject;
     this.messageBody  = messageInfo.messageBody;
 }
Beispiel #2
0
        public void SendTest()
        {
            // Arrange
            var emailInfo    = new UserEmailInformation("*****@*****.**", "Kelli Summers");
            var emailMessage = new JudgeEmailMessage("Test Project 100", ProjectStage.Approved);
            var emailService = new EmailService(emailInfo, emailMessage);

            // Act
            emailService.Send();
        }
        //public ActionResult Create(IFormCollection collection)
        public ActionResult Create(IFormCollection form)
        {
            Microsoft.Extensions.Primitives.StringValues val1, val2, val3, val4;
            try
            {
                // ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");

                form.TryGetValue("ProjectName", out val1);
                form.TryGetValue("Description", out val2);
                form.TryGetValue("StartDate", out val3);
                form.TryGetValue("EndDate", out val4);

                Projects proj = new Projects();
                proj.Id          = GetTempID;
                proj.CreatedBy   = GetUserID;
                proj.Name        = val1.ToString();
                proj.Description = val2.ToString();
                proj.StartDate   = DateTime.Parse(val3.ToString());
                proj.EndDate     = DateTime.Parse(val4.ToString());;
                proj.ApprovedOn  = DateTime.Today;
                proj.CreatedOn   = DateTime.Today;
                proj.ModifiedOn  = DateTime.Today;
                proj.ApprovedBy  = proj.CreatedBy;
                proj.ModifiedBy  = proj.CreatedBy;
                this.context.Projects.Add(proj);
                this.context.SaveChanges();
                //proj. = 1;
                //HTTP POST
                //var postTask = client.PostAsJsonAsync<Project>("project", proj);


                // Campaign manager notification
                for (int i = 0; i < proj.WorkflowId; i++)
                {
                    var campaignManager = this.context.Workflow.Find(i++);
                    var emailInfo       = new UserEmailInformation(campaignManager.Name, campaignManager.EmailAddress);
                    var messageInfo     = new CampaignManagerNotificationEmail(proj.Name);
                    new EmailService(emailInfo, messageInfo);
                }
                //var result = postTask.Result;
                //if (result.IsSuccessStatusCode)
                //{
                return(RedirectToAction("MyProjects"));
                //}
                //}
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Beispiel #4
0
        public IActionResult Judge(string projectId, string stage, string emailAddress, string name)
        {
            ViewData["Message"] = "Determine application acceptance the application";
            //var jObj = JsonConvert.DeserializeObject<JudgeObject>(data);
            int          stg          = Int32.Parse(stage);
            ProjectStage projectStage = (ProjectStage)stg;
            //UserEmailInformation emailInfo = jObj.userEmailInformation;
            UserEmailInformation emailInfo = new UserEmailInformation(emailAddress, name);

            int id             = Int32.Parse(projectId);
            var currentProject = this.context.Projects.First(x => x.Id == id);

            currentProject.Stage = projectStage;
            this.context.SaveChanges();

            var message      = new JudgeEmailMessage(currentProject.Name, projectStage);
            var emailService = new EmailService(emailInfo, message);

            emailService.Send();

            return(RedirectToAction("Index", "ApprovalsDashboard"));
        }
Beispiel #5
0
 public ActionResult UpdateUserEmail([FromBody] UserEmailInformation userEmailInformation)
 {
     return(Ok(Service.UpdateUserEmail(userEmailInformation.Id, userEmailInformation.Email)));
 }