예제 #1
0
        public ActionResult Modify([Bind(Prefix = "")] Models.SoftwareLicensesLine model)
        {
            var db = new CodeFirst.CodeFirst();

            if (ModelState.IsValid)
            {
                var line = db.Software_Licenses_Line.Where(v => v.LineID == model.LineID).SingleOrDefault();

                if (line != null)
                {
                    line.EquipmentID       = model.EquipmentID;
                    line.LicenceID         = model.LicenceID;
                    line.LastActivatedDate = model.LastActivatedDate;
                    line.Activated         = model.Activated;
                    db.SaveChanges();
                }

                TempData["js"] = "myUpdateSuccess()";
                return(RedirectToAction("Index", "EquipmentSoftwareLicenses"));
            }

            model.Softwares  = db.Software_Licenses.ToList();
            model.Equipments = db.Equipments.AsEnumerable().Select(e => new SelectListItem
            {
                Value = e.EquipmentID.ToString(),
                Text  = e.ManufacturerName + " " + e.ModelNumber
            }).ToList();
            return(View("Index", model));
        }
예제 #2
0
        // GET: ModifyEquipmentSoftwareLicense
        public ActionResult Index(string lineID)
        {
            CodeFirst.CodeFirst         db      = new CodeFirst.CodeFirst();
            Models.SoftwareLicensesLine myModel = new Models.SoftwareLicensesLine();
            if (lineID != null)
            {
                var intLineID = Int32.Parse(lineID);
                var myLine    = db.Software_Licenses_Line.Where(i => i.LineID == intLineID).FirstOrDefault();

                myModel.LineID            = myLine.LineID;
                myModel.LicenceID         = myLine.LicenceID;
                myModel.EquipmentID       = myLine.EquipmentID;
                myModel.LastActivatedDate = myLine.LastActivatedDate;
                myModel.Activated         = myLine.Activated;

                myModel.Softwares  = db.Software_Licenses.ToList();
                myModel.Equipments = db.Equipments.AsEnumerable().Select(e => new SelectListItem
                {
                    Value = e.EquipmentID.ToString(),
                    Text  = e.ManufacturerName + " " + e.ModelNumber
                }).ToList();
                return(View(myModel));
            }

            myModel.Softwares  = db.Software_Licenses.ToList();
            myModel.Equipments = db.Equipments.AsEnumerable().Select(e => new SelectListItem
            {
                Value = e.EquipmentID.ToString(),
                Text  = e.ManufacturerName + " " + e.ModelNumber
            }).ToList();
            return(View(myModel));
        }
예제 #3
0
        // GET: AddEquipmentSoftwareLicense
        public ActionResult Index(string equipmentID, string licenceID)
        {
            Models.SoftwareLicensesLine line = new Models.SoftwareLicensesLine();

            line.EquipmentID = Int32.Parse(equipmentID);
            line.LicenceID   = Int32.Parse(licenceID);

            return(View(line));
        }
예제 #4
0
 // GET: EquipmentSoftwareLicenses
 public ActionResult Index()
 {
     Models.SoftwareLicensesLine myModel = new Models.SoftwareLicensesLine();
     if (TempData["model"] != null)
     {
         myModel = (Models.SoftwareLicensesLine)TempData["model"];
         TempData.Remove("model");
     }
     return(View(myModel));
 }
예제 #5
0
        public ActionResult Create([Bind(Prefix = "")] Models.SoftwareLicensesLine model)
        {
            var db = new CodeFirst.CodeFirst();

            if (ModelState.IsValid)
            {
                var item = db.Software_Licenses_Line.OrderByDescending(a => a.LicenceID).FirstOrDefault();

                db.Software_Licenses_Line.Add(new CodeFirst.Software_Licenses_Line
                {
                    EquipmentID       = model.EquipmentID,
                    LicenceID         = model.LicenceID,
                    LastActivatedDate = DateTime.Parse(model.LastActivatedDate.Value.ToString("yyyy-MM-dd")),
                    Activated         = model.Activated
                });

                db.SaveChanges();
                model.JavaScriptToRun = "mySuccess()";
                TempData["model"]     = model;
                return(RedirectToAction("Index", "EquipmentSoftwareLicenses"));
            }

            return(View("Index", model));
        }
예제 #6
0
        // GET: EquipmentSoftwareLicenseDetails
        public ActionResult Index(string lineID)
        {
            Models.SoftwareLicensesLine myModel = new Models.SoftwareLicensesLine();
            CodeFirst.CodeFirst         db      = new CodeFirst.CodeFirst();
            if (lineID != null)
            {
                var intLineID   = Int32.Parse(lineID);
                var myLine      = db.Software_Licenses_Line.Where(i => i.LineID == intLineID).FirstOrDefault();
                var myEquipment = db.Equipments.Where(i => i.EquipmentID == myLine.EquipmentID).FirstOrDefault();
                var mySoftware  = db.Software_Licenses.Where(i => i.LicenceID == myLine.LicenceID).FirstOrDefault();


                myModel.LineID            = myLine.LineID;
                myModel.EquipmentID       = myLine.EquipmentID;
                myModel.LicenceID         = myLine.LicenceID;
                myModel.LastActivatedDate = myLine.LastActivatedDate;
                myModel.Activated         = myLine.Activated;
                myModel.Manufacturer      = myEquipment.ManufacturerName;
                myModel.ModelNumber       = myEquipment.ModelNumber;
                myModel.SoftwareName      = mySoftware.SoftwareName;
            }

            return(View(myModel));
        }