Exemple #1
0
        public IActionResult RegisterCustomerWithVehicle(string vrm, string title, string firstname, string lastname, string email, string tel, string address1, string address2, string county, string postcode)
        {
            if (!isAuthenticated())
            {
                return(RedirectToAction("Login", "Auth"));
            }

            Customer customer = new Customer
            {
                customerID   = JobProvider.GetUniqueKey(8),
                email        = email,
                registered   = DateTime.Today,
                title        = title,
                firstname    = firstname,
                lastname     = lastname,
                addressline1 = address1,
                addressline2 = address2,
                county       = county,
                postcode     = postcode,
                phone        = tel
            };

            CustomerProvider.addCustomer(customer);
            CustomerProvider.assignVehicle(vrm, customer.customerID);

            return(RedirectToAction("BookAddVehicle", "Job", new { vrm = vrm }));
        }
Exemple #2
0
        public IActionResult AddNote(string type, string body, string jobID)
        {
            if (!isAuthenticated())
            {
                return(RedirectToAction("Login", "Auth"));
            }

            JobNote note = new JobNote
            {
                id   = JobProvider.GetUniqueKey(255),
                type = type,
                body = body,
                time = DateTime.Now,
                user = UserProvider.getUserFromUsername(HttpContext.Session.GetString("user"))
            };

            JobProvider.addJobNote(note, jobID);

            if (type == "Invoice")
            {
                JobProvider.updateStatus(jobID, "Complete - Awaiting Payment");
            }

            return(RedirectToAction("ViewJob", "Job", new { id = jobID }));
        }
Exemple #3
0
        public IActionResult BookVehicle(string type, string issue, string cosmetic, string resolution, string labour, string bay, string customerID, string vrm, string mechanic)
        {
            if (!isAuthenticated())
            {
                return(RedirectToAction("Login", "Auth"));
            }

            JobNote estimate = new JobNote
            {
                id   = JobProvider.GetUniqueKey(255),
                type = "Estimate",
                body = "Issue: " + issue + " Cosmetic Condition: " + cosmetic + " Proposed Resolution: " + resolution,
                time = DateTime.Now,
                user = UserProvider.getUserFromUsername(HttpContext.Session.GetString("user"))
            };

            JobNote labourEstimate = new JobNote
            {
                id   = JobProvider.GetUniqueKey(255),
                type = "Labour Estimate",
                body = labour,
                time = DateTime.Now,
                user = UserProvider.getUserFromUsername(HttpContext.Session.GetString("user"))
            };

            List <JobNote> notes = new List <JobNote>();

            notes.Add(estimate);
            notes.Add(labourEstimate);

            Job job = new Job
            {
                jobID    = JobProvider.GetUniqueNumber(8),
                start    = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day),
                end      = null,
                paid     = null,
                bay      = Int32.Parse(bay),
                status   = "Ongoing",
                type     = type,
                customer = CustomerProvider.getCustomerFromID(customerID),
                vehicle  = VehicleProvider.getVehicleFromVRM(vrm),
                notes    = notes,
                labour   = new Dictionary <string, float>(),
                mechanic = UserProvider.getUserFromUsername(mechanic)
            };

            JobProvider.createJob(job);

            TempData["JobID"] = job.jobID;

            return(RedirectToAction("ViewJob", new { id = job.jobID }));
        }
Exemple #4
0
        public IActionResult Pay(string jobID)
        {
            if (!isAuthenticated())
            {
                return(RedirectToAction("Login", "Auth"));
            }

            JobProvider.updateStatus(jobID, "Complete - Paid");

            JobNote note = new JobNote
            {
                id   = JobProvider.GetUniqueKey(255),
                type = "Payment",
                body = "Customer payment taken.",
                time = DateTime.Now,
                user = UserProvider.getUserFromUsername(HttpContext.Session.GetString("user"))
            };

            JobProvider.addJobNote(note, jobID);

            return(RedirectToAction("ViewJob", "Job", new { id = jobID }));
        }