コード例 #1
0
        public ActionResult Details(int id)
        {
            if (id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }


            var reports = new Reports();

            reports = CARS2019.Models.TSProd.ReportGivenID(id);

            if (reports == null)
            {
                return(HttpNotFound());
            }
            var checkedDepartmentList = TSProd.GetChecksGivenReportID(id);

            if (checkedDepartmentList != null)
            {
                ViewData["checkedDepartmentList"] = checkedDepartmentList;
            }

            return(View(reports));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (Session["canDeleteEntry"] != null)
            {
                if (Session["canDeleteEntry"].ToString() == "False")
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }

            int deleteResults = TSProd.DeleteReport(id);

            if (deleteResults == 0) // Successfully inserted report
            {
                return(RedirectToAction("Index"));
            }

            var checkedDepartmentList = TSProd.GetChecksGivenReportID(id);

            if (checkedDepartmentList != null)
            {
                ViewData["checkedDepartmentList"] = checkedDepartmentList;
            }

            return(RedirectToAction("Index")); // Should go to error page *************************************************
        }
コード例 #3
0
        public void StoreDepartmentValues(DepartmentCheck[] departmentJSON)
        {
            if (departmentJSON != null)
            {
                //Deserialize JSON from Edit page

                //JavaScriptSerializer js = new JavaScriptSerializer();
                //DepartmentCheck[] departmentData = js.Deserialize<DepartmentCheck[]>(departmentJSON);
                //DepartmentCheck departmentData = departmentJSON;

                // Loop through each row
                // call UpdateDeparmentCheck(pass in id, operatorName, quantity, completedDate)
                foreach (var row in departmentJSON)
                {
                    var id            = row.id;
                    var operatorName  = row.operatorName;
                    var quantity      = row.quantity ?? "0";
                    var completedDate = row.completedDate ?? DateTime.Now.ToString();
                    if (id > 0 && operatorName != null)
                    {
                        TSProd.UpdateDeparmentCheck(id, operatorName, Int32.Parse(quantity), DateTime.Parse(completedDate));
                    }
                }
            }
        }
コード例 #4
0
        public ActionResult Delete(int id)
        {
            if (id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (Session["canDeleteEntry"] != null)
            {
                if (Session["canDeleteEntry"].ToString() == "False")
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }

            var reports = new Reports();

            reports = CARS2019.Models.TSProd.ReportGivenID(id);

            if (reports == null)
            {
                return(HttpNotFound());
            }
            var checkedDepartmentList = TSProd.GetChecksGivenReportID(id);

            if (checkedDepartmentList != null)
            {
                ViewData["checkedDepartmentList"] = checkedDepartmentList;
            }

            return(View(reports));
        }
コード例 #5
0
        public ActionResult ChangeStatus(int id, int reportStatus, string reworkType)
        {
            if (Session["canDeleteEntry"] != null)
            {
                if (Session["canDeleteEntry"].ToString() == "False")
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }

            int statusResults = TSProd.ChangeStatus(id, reportStatus);

            if (statusResults == 0) // Successfully inserted report
            {
                return(RedirectToAction("Index", new { reportStatus, reworkType }));
            }

            var checkedDepartmentList = TSProd.GetChecksGivenReportID(id);

            if (checkedDepartmentList != null)
            {
                ViewData["checkedDepartmentList"] = checkedDepartmentList;
            }

            return(RedirectToAction("Index", new { reportStatus, reworkType })); // Should go to an error page *************************************************
        }
コード例 #6
0
        public ActionResult Edit([Bind(Include = "id,reporting_employee,job_ID,department_ID,component,problem_ID,severity_id,rework_employee," +
                                                 "expectedQuantity,calculated_cost,throwOutInitials,notes,corrective_action,created_Date,pages,pressSections," +
                                                 "proofsRequired,reworkCompleteLocation,SOMaterials,reworkProcess,reportStatus,reworkType,vendor")] Reports reports)
        {
            if (ModelState.IsValid)
            {
                if (Session["canEditEntry"] != null)
                {
                    if (Session["canEditEntry"].ToString() == "False")
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    }
                }

                int insertResults = TSProd.UpdateCARSReport(
                    reports.id
                    , reports.job_ID
                    , reports.reporting_employee
                    , reports.department_ID
                    , reports.rework_employee
                    , reports.expectedQuantity
                    , reports.component
                    , reports.problem_ID
                    , reports.severity_id
                    , (reports.calculated_cost ?? 0)
                    , reports.throwOutInitials
                    //, reports.throwOutDate
                    , reports.notes
                    , reports.corrective_action
                    , reports.pages
                    , reports.pressSections
                    , reports.proofsRequired
                    , reports.reworkCompleteLocation
                    , reports.SOMaterials
                    , reports.reworkProcess
                    , reports.reportStatus // added 3-21-19 jb
                    , reports.reworkType   // added 3-21-19 jb
                    , reports.vendor       // added 3-21-19 jb
                    );

                if (insertResults == 0) // Successfully inserted report
                {
                    if (TempData["tempChecked"] != null)
                    {
                        foreach (var dept in (IEnumerable <String>)TempData["tempChecked"])
                        {
                            TSProd.InsertDeparmentCheck(reports.id, Int32.Parse(dept.ToString()));
                        }
                    }
                    return(RedirectToAction("Index", new { reports.reportStatus, reports.reworkType }));
                }

                //db.Entry(reports).State = EntityState.Modified;
                //db.SaveChanges();
            }
            return(View(reports));
        }
コード例 #7
0
 public string GetDepartmentNameFromID(int deptID)
 {
     if (deptID > -1)
     {
         string strDepartmentName = TSProd.GetDepartmentNameFromID(deptID);
         return(strDepartmentName);
     }
     else
     {
         string strDepartmentName = "ERROR";
         return(strDepartmentName);
     }
 }
コード例 #8
0
 public JsonResult JobDetails(string jobNumber)
 {
     if (jobNumber != "")
     {
         string jsonJobDetails = JsonConvert.SerializeObject(TSProd.GetCARSJobDetails(jobNumber));
         return(Json(jsonJobDetails, JsonRequestBehavior.AllowGet));
     }
     else
     {
         string jsonJobDetails = "[{\"job_id\":\"ERROR\",\"cust_name\":\"ERROR\",\"Title\":\"ERROR\",\"csr_name\":\"ERROR\",\"cust_key\":\"ERROR\"}]";
         return(Json(jsonJobDetails, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #9
0
 public JsonResult ProblemList(string deptID) //It will be fired from Jquery ajax call
 {
     if (deptID != "")
     {
         //int intdeptID = Int32.Parse(deptID);
         string strJsonProblems = JsonConvert.SerializeObject(TSProd.GetDepartmentProblemsList(deptID));
         return(Json(strJsonProblems, JsonRequestBehavior.AllowGet));
     }
     else
     {
         string strJsonProblems = "[{\"ProblemID\":-1,\"ProblemDescription\":\"ERROR\"}]";
         return(Json(strJsonProblems, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #10
0
        public ActionResult Edit(int id)
        {
            if (id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (Session["canEditEntry"] != null)
            {
                if (Session["canEditEntry"].ToString() == "False")
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }

            //Reports reports = db.Reports.Find(id);
            var reports = new Reports();

            reports = CARS2019.Models.TSProd.ReportGivenID(id);
            if (reports == null)
            {
                return(HttpNotFound());
            }

            var items = CARS2019.Models.TSProd.CARSDepartmentList().ToList();

            if (items != null)
            {
                ViewBag.data = items;
            }

            var checkedDepartmentList = TSProd.GetChecksGivenReportID(id);

            if (checkedDepartmentList != null)
            {
                ViewData["checkedDepartmentList"] = checkedDepartmentList;
            }

            return(View(reports));
        }
コード例 #11
0
 public void ToggleCheckedDepartment(int reportID, int departmentID)
 {
     TSProd.DeleteCheckGivenId(reportID, departmentID);
 }
コード例 #12
0
        public ActionResult Create([Bind(Include = "id,reporting_employee,job_ID,department_ID,component,problem_ID,severity_id," +
                                                   "rework_employee,expectedQuantity,calculated_cost,throwOutInitials,notes,corrective_action," +
                                                   "created_Date,pages,pressSections,proofsRequired,reworkCompleteLocation,SOMaterials,reworkProcess,reworkType,vendor,reportStatus")] Reports reports)
        {
            if (ModelState.IsValid)
            {
                if (reports.calculated_cost == null)
                {
                    reports.calculated_cost = 0;
                }

                int insertResults = TSProd.InsertCARSReport(
                    reports.job_ID
                    , reports.reporting_employee
                    , reports.department_ID
                    , reports.rework_employee
                    , reports.expectedQuantity
                    , reports.component
                    , reports.problem_ID
                    , reports.severity_id
                    , (reports.calculated_cost ?? 0)
                    , reports.throwOutInitials
                    //, reports.throwOutDate
                    , reports.notes
                    , reports.corrective_action
                    , reports.pages
                    , reports.pressSections
                    , reports.proofsRequired
                    , reports.reworkCompleteLocation
                    , reports.SOMaterials
                    , reports.reworkProcess // added 3-21-19 jb
                    , reports.reworkType    // added 3-21-19 jb
                    , reports.vendor        // added 3-21-19 jb
                    , reports.reportStatus  // added 3-21-19 jb
                    );

                if (insertResults > 0) // Successfully inserted report
                {
                    //db.Reports.Add(reports);
                    //db.SaveChanges();
                    //db.Entry(reports).GetDatabaseValues();

                    string departmentEmailList = "[email protected]; [email protected]";

                    departmentEmailList += ";" + TSProd.GetCSRandSalesEmailStringFromJobNumber(reports.job_ID);

                    if (TempData["tempChecked"] != null)
                    {
                        foreach (var dept in (IEnumerable <String>)TempData["tempChecked"])
                        {
                            TSProd.InsertDeparmentCheck(insertResults, Int32.Parse(dept.ToString()));
                            string departmentEmail = TSProd.GetDepartmentEmail(Int32.Parse(dept));
                            departmentEmailList += ";" + departmentEmail;
                        }
                    }

                    var targetURL = "https://cars.tshore.com/Reports/Details/" + insertResults;
                    var emailBody = "Issue submitted for job number: " + reports.job_ID + "<br />";
                    MailSendHelper.SendingDepartmentEmail(reports.reporting_employee, departmentEmailList, emailBody, targetURL, reports.job_ID);


                    return(RedirectToAction("Index", new { reports.reportStatus, reports.reworkType }));
                }
            }

            return(View(reports));
        }