Пример #1
0
        public ActionResult AddReport(string idRequest, string details)
        {
            int id = Convert.ToInt32(idRequest);

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TechnicianReport technicianReport = db.TechnicianReports.Where(t => t.ReportItem == id).FirstOrDefault();
            var user = db.Users.Where(u => u.JobNumber == User.Identity.Name).FirstOrDefault();

            if (technicianReport == null)
            {
                return(HttpNotFound());
            }
            if (ModelState.IsValid)
            {
                technicianReport.Details        = details;
                technicianReport.LastUpdateBy   = user.FirstNameEn + " " + user.LastNameEn;
                technicianReport.LastUpdateDate = DateTime.Now;

                db.Entry(technicianReport).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("status", "RequestItems", new { approv = "10", id = technicianReport.ReportItem }));
            }

            return(RedirectToAction("Details", "RequestItems", new { id = technicianReport.RequestItem.RequestItemsId }));
        }
Пример #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            TechnicianReport technicianReport = db.TechnicianReports.Find(id);

            db.TechnicianReports.Remove(technicianReport);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
 public ActionResult Edit([Bind(Include = "ReportId,Details,CreatedBy,CreatedDate,LastUpdateBy,LastUpdateDate,Active,ReportItem,UserId")] TechnicianReport technicianReport)
 {
     if (ModelState.IsValid)
     {
         db.Entry(technicianReport).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ReportItem = new SelectList(db.RequestItems, "RequestItemsId", "LastUpdateBy", technicianReport.ReportItem);
     return(View(technicianReport));
 }
Пример #4
0
        // GET: TechnicianReports/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TechnicianReport technicianReport = db.TechnicianReports.Find(id);

            if (technicianReport == null)
            {
                return(HttpNotFound());
            }
            return(View(technicianReport));
        }
Пример #5
0
        // GET: TechnicianReports/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TechnicianReport technicianReport = db.TechnicianReports.Find(id);

            if (technicianReport == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ReportItem = new SelectList(db.RequestItems, "RequestItemsId", "LastUpdateBy", technicianReport.ReportItem);
            return(View(technicianReport));
        }
Пример #6
0
        public ActionResult Assign(string idRequest, string UserId)
        {
            var user = db.Users.Where(u => u.JobNumber == User.Identity.Name).FirstOrDefault();
            TechnicianReport technicianReport = new TechnicianReport();

            technicianReport.ReportItem     = Convert.ToInt32(idRequest);
            technicianReport.UserId         = Convert.ToInt32(UserId);
            technicianReport.CreatedBy      = user.FirstNameEn + " " + user.LastNameEn;
            technicianReport.CreatedDate    = DateTime.Today;
            technicianReport.LastUpdateBy   = user.FirstNameEn + " " + user.LastNameEn;
            technicianReport.LastUpdateDate = DateTime.Today;
            technicianReport.Active         = true;

            db.TechnicianReports.Add(technicianReport);
            db.SaveChanges();

            return(RedirectToAction("status", "RequestItems", new { approv = "7", id = technicianReport.ReportItem }));
        }