Beispiel #1
0
        public ActionResult CreatePOC(CreateEditPOCViewModel VM, string submitButton)
        {
            //Agregar objeto de destination y de port directamente con AJAX en los typeahead
            if (VM.Alerts == null)
                VM.Alerts = new List<AlertItem>();

            else if(VM.Alerts.Count != 0)
            {
                VM.Alerts.Clear();
            }

            int status = 0;

            switch (submitButton)
            {
                case "Save":
                    status = 1;
                    validateCreatePost(VM, false);
                    break;
                case "Save and Send":
                    status = 2;
                    validateCreatePost(VM, true);
                    break;
            }

            if (VM.Alerts.Count > 0)
            {
                VM.Products = db.Product.ToList<Product>();
                VM.Incoterms = db.Incoterm.ToList<Incoterm>();
                return View(VM);
            }

            POC POC = new POC();
            POC = VM.POC;

            POC.Status = status;

            POC.CreationDate = DateTime.Today;

            Schedule schedule = new Schedule();

            db.POC.Add(POC);

            schedule.POC = POC;

            db.Schedule.Add(schedule);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                VM.Alerts.Add(new AlertItem("Unexpected database error. Changes could not be saved."));
            }

            return RedirectToAction("Inbox", new {controller = "SCM_Inbox" });
        }
Beispiel #2
0
 public virtual MvcMailMessage Notification(string to, POC POC)
 {
     ViewBag.POC = POC;
     return Populate(x =>
     {
         x.Subject = "Notification";
         x.ViewName = "Notification";
         x.To.Add(to);
     });
 }