Ejemplo n.º 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 }));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            using (var memoryStream = new MemoryStream())
            {
                await FileUpload.FormFile.CopyToAsync(memoryStream);

                // Upload the file if less than 2 MB
                if (memoryStream.Length < 2097152)
                {
                    var file = new NetsuiteEntry.RENDER()
                    {
                        Content = memoryStream.ToArray()
                    };

                    // _context.File.Add(file);


                    _context.NetsuiteEntry.Add(NetsuiteEntry);
                    await _context.SaveChangesAsync();
                }
                else
                {
                    ModelState.AddModelError("File", "The file is too large.");
                }
            }
            // return RedirectToPage("./Index");
            return(RedirectToPage("./Index", new { NetsuiteEntry.LEAD_NUMBER }));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Notes.Add(Notes);
            await _context.SaveChangesAsync();

            return(RedirectToPage("/ProjectView/ProjectCard/Home/Details", new { Notes.LEAD_NUMBER }));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Projects.Add(Projects);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Scope.Add(Scope);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Details", new { Scope.LEAD_NUMBER }));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> OnPostAsync(string LEAD_NUMBER)
        {
            if (LEAD_NUMBER == null)
            {
                return(NotFound());
            }

            Projects = await _context.Projects.FindAsync(LEAD_NUMBER);

            if (Projects != null)
            {
                _context.Projects.Remove(Projects);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            NetsuiteEntry = await _context.NetsuiteEntry.FindAsync(id);

            if (NetsuiteEntry != null)
            {
                _context.NetsuiteEntry.Remove(NetsuiteEntry);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Scope = await _context.Scope.FindAsync(id);

            if (Scope != null)
            {
                _context.Scope.Remove(Scope);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Projects = await _context.Projects.FindAsync(id);

            Scope = await _context.Scope.FirstOrDefaultAsync(s => s.LEAD_NUMBER == Projects.LEAD_NUMBER);

            Notes = await _context.Notes.Where(pt => pt.LEAD_NUMBER == Projects.LEAD_NUMBER).ToListAsync();

            Revisions = await _context.Revision.Where(pt => pt.LEAD_NUMBER == Projects.LEAD_NUMBER).ToListAsync();

            if (Projects != null)
            {
                _context.Projects.Remove(Projects);
                if (Scope != null)
                {
                    _context.Scope.Remove(Scope);
                }
                if (Notes != null)
                {
                    foreach (var note in Notes)
                    {
                        _context.Notes.Remove(note);
                    }
                }
                if (Revisions != null)
                {
                    foreach (var rev in Revisions)
                    {
                        _context.Revision.Remove(rev);
                    }
                }


                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            Projects = await _context.Projects.ToListAsync();

            findNextLead();
            Project.LEAD_NUMBER = nextLead;
            Scope.LEAD_NUMBER   = nextLead;
            Project.DELIVERABLE = Scope.FIRST_DELIVERABLE;
            Project.CUSTOMER    = Scope.CUSTOMER_SCOPE;
            string[] splitString = Scope.SCOPE_ORIGINATOR.Split("@");
            splitString[1].ToUpper();
            Project.SALESMAN = splitString[0].Substring(1);

            _context.Projects.Add(Project);
            _context.Scope.Add(Scope);
            await _context.SaveChangesAsync();

            using (var smtp = new SmtpClient())
            {
                string newLine = Environment.NewLine;
                var    message = new MailMessage
                {
                    Body =
                        "Project Name: " + Project.PROJECT_NAME + newLine +
                        "Original Scope: " + Scope.ORIGINAL_SCOPE + newLine +
                        "Date of Request: " + Scope.DATE_ENTERED + newLine +
                        "CONNECTIONS: " + Scope.CONNECTIONS + newLine +
                        "Customer: " + Scope.CUSTOMER_SCOPE + newLine +
                        "Date Needed: " + Scope.DATE_NEEDED + newLine +
                        "First Deliverable: " + Scope.FIRST_DELIVERABLE + newLine +
                        "Type of Product: " + Scope.PRODUCT_TYPE + newLine +
                        "Scope Originator: " + Scope.SCOPE_ORIGINATOR + newLine +
                        "Similar to PN: " + Scope.SIMILAR_TO + newLine +
                        "Where to Send: " + Scope.WHERE_SEND + newLine +
                        "EAU: " + Scope.EAU + newLine +
                        "Target Price: " + Scope.TARGET_PRICE,
                    Subject = Project.PROJECT_NAME + ":" + Scope.LEAD_NUMBER,
                    From    = new MailAddress("*****@*****.**")
                };
                message.To.Add(Scope.SCOPE_ORIGINATOR);
                if (string.Compare(Scope.SCOPE_ORIGINATOR, "*****@*****.**") != 0)
                {
                    message.To.Add("*****@*****.**");
                }
                if (string.Compare(Scope.SCOPE_ORIGINATOR, "*****@*****.**") != 0)
                {
                    message.To.Add("*****@*****.**");
                }
                if (string.Compare(Scope.SCOPE_ORIGINATOR, "*****@*****.**") != 0)
                {
                    message.To.Add("*****@*****.**");
                }
                if (string.Compare(Scope.SCOPE_ORIGINATOR, "*****@*****.**") != 0)
                {
                    message.To.Add("*****@*****.**");
                }

                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("/Index"));
        }
Ejemplo n.º 12
0
        public async Task <IActionResult> OnPostAsync()
        {
            Project = await _context.Projects.FirstOrDefaultAsync(m => m.LEAD_NUMBER.Equals(LEAD));

            if (!ModelState.IsValid)
            {
                return(Page());
            }
            using (var smtp = new SmtpClient())
            {
                //smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                // smtp.PickupDirectoryLocation = @"c:\maildump";
                string newLine = Environment.NewLine;
                var    message = new MailMessage
                {
                    Body =
                        "Project Name: " + Revision.REV_DETAILS + newLine +
                        "Original Scope: " + Revision.LEAD_NUMBER + newLine +
                        "Date of Request: " + Revision.ENTERED_BY + newLine +
                        "CONNECTIONS: " + Revision.DATE_ENTERED + newLine,
                    Subject = "new Revision for " + Revision.LEAD_NUMBER,
                    From    = new MailAddress("*****@*****.**")
                };
                switch (Project.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: " + Project.EE_LEAD;
                    message.To.Add("*****@*****.**");
                    break;
                }
                message.To.Add("*****@*****.**");
                message.To.Add("*****@*****.**");
                message.To.Add("*****@*****.**");
                message.To.Add("*****@*****.**");
                smtp.UseDefaultCredentials = false;

                smtp.Host           = "email.weimerbearing.com";
                smtp.Port           = 25;
                smtp.EnableSsl      = false;
                smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                await smtp.SendMailAsync(message);
            }

            _context.Revision.Add(Revision);
            await _context.SaveChangesAsync();

            return(RedirectToPage("/ProjectView/ProjectCard/ScopeAndRev/Index", new { Revision.LEAD_NUMBER }));
        }
Ejemplo n.º 13
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");
        }
Ejemplo n.º 14
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 }));
        }