Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "MaintainanceId,StudentNAme,ReportDate,FixedDate,Comments,Contractor,Image,ResName,Status")] Maintainance maintainance, HttpPostedFileBase file)
        {
            string currentUserId = User.Identity.GetUserName();
            var    getStudent    = db.Students.Where(p => p.Email == currentUserId).Select(p => p.Name).FirstOrDefault();
            var    getRes        = db.Students.Where(p => p.Email == currentUserId).Select(p => p.ResName).FirstOrDefault();

            if (file != null && file.ContentLength > 0)
            {
                maintainance.Image = ConvertToBytes(file);
            }
            if (ModelState.IsValid)
            {
                maintainance.StudentNAme = getStudent;

                maintainance.ReportDate   = DateTime.Now;
                maintainance.StudentEmail = User.Identity.GetUserName();

                maintainance.ResName = getRes;
                maintainance.Status  = "Awaiting";

                db.Maintainances.Add(maintainance);
                db.SaveChanges();
                return(RedirectToAction("Index2"));
            }

            return(View(maintainance));
        }
Ejemplo n.º 2
0
        void OnButtonClick(object s, EventArgs e)
        {
            CommandButton b = (s as CommandButton);

            if (b.Text == Resources.RequestMaintainance)
            {
                Maintainance maintainance = new Maintainance();
                maintainance.Show(this);
            }
            else if (b.Text == Resources.RequestStudentCard)
            {
                StudentCard studentCard = new StudentCard();
                studentCard.Show(this);
            }
            else if (b.Text == Resources.RequestATMCard)
            {
                ATMCard card = new ATMCard();
                card.Show();
            }
            else if (b.Text == Resources.RequestCarLicense)
            {
                CarBadge car = new CarBadge();
                car.Show();
            }
            else
            {
                Close();
            }
        }
Ejemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Maintainance maintainance = db.Maintainances.Find(id);

            db.Maintainances.Remove(maintainance);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "MaintainanceId,StudentNAme,ReportDate,FixedDate,Comments,Contractor,Image")] Maintainance maintainance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(maintainance).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(maintainance));
 }
Ejemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "MProcID,User,date,LivestockID,ProductId,ProductCategory,MainPId")] Maintainance maintainance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(maintainance).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.LivestockID = new SelectList(db.LivesStocks, "LivestockID", "Code", maintainance.LivestockID);
     ViewBag.MainPId     = new SelectList(db.MaintainanceProcesses, "MainPId", "MainName", maintainance.MainPId);
     ViewBag.ProductId   = new SelectList(db.MaintainanceStocks, "ProductID", "ProductName", maintainance.ProductId);
     return(View(maintainance));
 }
Ejemplo n.º 6
0
        // GET: Maintainances/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Maintainance maintainance = db.Maintainances.Find(id);

            if (maintainance == null)
            {
                return(HttpNotFound());
            }
            return(View(maintainance));
        }
Ejemplo n.º 7
0
        // GET: Maintainances1/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Maintainance maintainance = db.Maintainances.Find(id);

            if (maintainance == null)
            {
                return(HttpNotFound());
            }
            ViewBag.LivestockID = new SelectList(db.LivesStocks, "LivestockID", "Code", maintainance.LivestockID);
            ViewBag.MainPId     = new SelectList(db.MaintainanceProcesses, "MainPId", "MainName", maintainance.MainPId);
            ViewBag.ProductId   = new SelectList(db.MaintainanceStocks, "ProductID", "ProductName", maintainance.ProductId);
            return(View(maintainance));
        }
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DriverSalary?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DriverWorkHours?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DriverServiceHours?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (VehiculeHoursPerDay?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (VehiculeDaysPerYear?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (RoadTax?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (VehiculeInsurance?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (GoodsInssurance?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Maintainance?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DaysOfReplacementVehicules?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CostOfReplacement?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Cost?.GetHashCode() ?? 0);
            return(hashCode);
        }
Ejemplo n.º 9
0
        // GET: Maintainances1/Create
        public ActionResult Create(int id)
        {
            var livestockmaintainanceStock = new LivestockMaintainanceStock();
            var maintainanceStock          = new MaintainanceStock();
            var maintainance = new Maintainance();
            var livestock    = db.LivesStocks.Find(id);

            maintainance.User        = User.Identity.GetUserName();
            maintainance.date        = maintainance.DateTimeNow();
            maintainance.LivesStock  = livestock;
            maintainance.LivestockID = livestock.LivestockID;

            List <LivestockMaintainanceStock> refinedMS = new List <LivestockMaintainanceStock>();

            refinedMS = livestockmaintainanceStock.ValidMaintainanceStock(db.LivestockMaintainanceStocks.ToList(), livestock.CategoryId);

            ViewBag.MainPId   = new SelectList(db.MaintainanceProcesses, "MainPId", "MainName");
            ViewBag.ProductId = new SelectList(maintainanceStock.ValidMaintainanceStock(refinedMS, db.MaintainanceStocks.ToList()), "ProductID", "ProductName");
            return(View(maintainance));
        }
Ejemplo n.º 10
0
        public ActionResult Done(int?id)
        {
            Maintainance     maintainance = db.Maintainances.Find(id);
            DoneMaintainance dm           = new DoneMaintainance();

            dm.MaintainanceId          = maintainance.MaintainanceId;
            dm.Comments                = maintainance.Comments;
            dm.Contractor              = maintainance.Contractor;
            dm.Contractor_EmailAddress = maintainance.Contractor_EmailAddress;
            dm.FixedDate               = System.DateTime.Now;
            dm.Image        = maintainance.Image;
            dm.ReportDate   = maintainance.ReportDate;
            dm.ResName      = maintainance.ResName;
            dm.Status       = "Completed";
            dm.StudentEmail = maintainance.StudentEmail;
            dm.StudentNAme  = maintainance.StudentNAme;
            db.DoneMaintainances.Add(dm);
            db.Maintainances.Remove(maintainance);
            db.SaveChanges();
            return(RedirectToAction("Index3"));
        }