示例#1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(NetsuiteEntry).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NetsuiteEntryExists(NetsuiteEntry.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index", new { NetsuiteEntry.LEAD_NUMBER }));
        }
示例#2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            if (Projects.PRIORITY == "Hold" && Projects.DELIVERABLE != "Hold" ||
                Projects.PRIORITY == "Graveyard" && Projects.DELIVERABLE != "Graveyard" ||
                Projects.PRIORITY == "Complete" && Projects.DELIVERABLE != "Complete")
            {
                Projects.COMMIT_DATE = DateTime.Now;
            }
            _context.Attach(Projects).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectsExists(Projects.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
示例#3
0
        public async Task<IActionResult> OnPostAsync()
        {
            if (Scope.Id != 0) 
            { Scope.LEAD_NUMBER = Projects.LEAD_NUMBER;
                
            }
            
            
            for (int i = 0; i < Notes.Count(); i++)
            {
                Notes[i].LEAD_NUMBER = Projects.LEAD_NUMBER;
            }
            for (int i = 0; i < Revisions.Count(); i++)
            {
                Revisions[i].LEAD_NUMBER = Projects.LEAD_NUMBER;
            }
            if (!ModelState.IsValid)
            {
                return Page();
            }

            _context.Attach(Projects).State = EntityState.Modified;
            if (Scope.Id != 0)
            { _context.Attach(Scope).State = EntityState.Modified; }
            
            for(int i = 0; i <Notes.Count(); i++)
            {
             _context.Attach(Notes[i]).State = EntityState.Modified;
            }
            for (int i = 0; i < Revisions.Count(); i++)
            {
                _context.Attach(Revisions[i]).State = EntityState.Modified;
            }
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectsExists(Projects.Id))
                {
                    return NotFound();
                }
                else if (!ScopeExists(Scope.Id))
                {
                    return NotFound();
                }
                else if (!NotesExists(Notes[0].Id))
                {
                    return NotFound();
                }
                else if (!RevisonExists(Revisions[0].Id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return RedirectToPage("/ProjectView/Index");
        }
示例#4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Projects).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectsExists(Projects.LEAD_NUMBER))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            using (var smtp = new SmtpClient())
            {
                string newLine = Environment.NewLine;
                var    message = new MailMessage
                {
                    Body = "You have been assigned a new project:" + newLine +
                           "Project Name: " + Projects.PROJECT_NAME + newLine +
                           "Lead Number: " + Projects.LEAD_NUMBER,
                    Subject = Projects.PROJECT_NAME + ":" + Projects.LEAD_NUMBER,
                    From    = new MailAddress("*****@*****.**")
                };
                //message.To.Add(Scope.SCOPE_ORIGINATOR);
                if (!string.Equals(currentEE, Projects.EE_LEAD)) //currentEE is null
                {
                    //maybe figure out a better way to do this

                    switch (Projects.EE_LEAD.ToLower())
                    {
                    case "collaer":
                        message.To.Add("*****@*****.**");
                        break;

                    case "rink":
                        message.To.Add("*****@*****.**");
                        break;

                    case "klepps":
                        message.To.Add("*****@*****.**");
                        break;

                    case "li":
                        message.To.Add("*****@*****.**");
                        break;

                    case "nowak":
                        message.To.Add("*****@*****.**");
                        break;

                    case "saul":
                        message.To.Add("*****@*****.**");
                        break;

                    case "kosloski":
                        message.To.Add("*****@*****.**");
                        break;

                    case "mazur":
                        message.To.Add("*****@*****.**");
                        break;

                    case "meythaler":
                        message.To.Add("*****@*****.**");
                        break;

                    case "shultz":
                        message.To.Add("*****@*****.**");
                        break;

                    default:
                        message.Body = "message assigned to non-existant, or mispelled EE: " + Projects.EE_LEAD;
                        message.To.Add("*****@*****.**");
                        break;
                    }
                    smtp.UseDefaultCredentials = false;
                    smtp.Host           = "email.weimerbearing.com";
                    smtp.Port           = 25;
                    smtp.EnableSsl      = false;
                    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                    await smtp.SendMailAsync(message);

                    //return RedirectToAction("Sent");
                }
            }

            return(RedirectToPage("./Details", new { Projects.LEAD_NUMBER }));
        }