Exemplo n.º 1
0
        public ActionResult SignUp(EmployeeRegisterView regEmp)
        {
            using (GerGarageDbEntities db = new GerGarageDbEntities())
            {
                EmployeeRegistry emp = new EmployeeRegistry();

                emp.EmployeeFirstName = regEmp.EmployeeFirstName;
                emp.EmployeeLastName  = regEmp.EmployeeLastName;
                emp.EmployeeContact   = regEmp.EmployeeContact;
                emp.EmployeeEmailId   = regEmp.EmployeeEmailId;
                emp.EmployeePassword  = regEmp.EmployeePassword;


                EmployeeLogin logEmp = new EmployeeLogin();
                logEmp.EmployeeEmailId  = regEmp.EmployeeEmailId;
                logEmp.EmployeePassword = regEmp.EmployeePassword;
                if (ModelState.IsValid)
                {
                    db.EmployeeRegistries.Add(emp);
                    db.EmployeeLogins.Add(logEmp);
                    db.SaveChanges();



                    return(RedirectToAction("Login"));
                }
                return(View());
            }
        }
        public List <BookingStatusTable> GetStatusTables()
        {
            GerGarageDbEntities       db            = new GerGarageDbEntities();
            List <BookingStatusTable> bookingStatus = db.BookingStatusTables.ToList();

            return(bookingStatus);
        }
Exemplo n.º 3
0
        public ActionResult Booking(CustomerAppointment custBooking)
        {
            using (GerGarageDbEntities db = new GerGarageDbEntities())
            {
                CustomersBooking booking = new CustomersBooking();

                JobDetail jobCard = new JobDetail();

                jobCard.BookingId       = custBooking.BookingId;
                booking.BookingDate     = custBooking.BookingDate;
                booking.CustomerName    = custBooking.CustomerName;
                jobCard.CustomerName    = custBooking.CustomerName;
                booking.CustomerEmail   = custBooking.CustomerEmail;
                booking.VehicleMake     = custBooking.VehicleMake;
                jobCard.CarMake         = custBooking.VehicleMake;
                booking.VehicleModel    = custBooking.VehicleModel;
                jobCard.CarModel        = custBooking.VehicleModel;
                booking.VehicleNumber   = custBooking.VehicleNumber;
                jobCard.CarNumber       = custBooking.VehicleNumber;
                booking.VehicleFuelType = custBooking.VehicleFuelType;
                booking.ServiceType     = custBooking.ServiceType;
                jobCard.ServiceType     = custBooking.ServiceType;
                booking.ServiceDate     = custBooking.ServiceDate;
                jobCard.ServiceDate     = custBooking.ServiceDate;
                booking.Remarks         = custBooking.Remarks;
                jobCard.CustomerMessage = custBooking.Remarks;

                db.CustomersBookings.Add(booking);
                db.JobDetails.Add(jobCard);
                db.SaveChanges();
            }

            ViewData["Confirmed"] = "Your Booking was succesfull";
            return(RedirectToAction("Home,Index"));
        }
        public List <EmployeeRegistry> GetEmployees()
        {
            GerGarageDbEntities     db = new GerGarageDbEntities();
            List <EmployeeRegistry> employeeRegistries = db.EmployeeRegistries.ToList();

            return(employeeRegistries);
        }
Exemplo n.º 5
0
        public List <ServicesAvailable> GetServicesAvailables()
        {
            GerGarageDbEntities      db = new GerGarageDbEntities();
            List <ServicesAvailable> servicesAvailables = db.ServicesAvailables.ToList();

            return(servicesAvailables);
        }
Exemplo n.º 6
0
        /*The following code is to fetch data from the Vehicle Type DB and populate them in the Drop Down List*/
        public List <VehicleMake> GetVehicleMakes()
        {
            GerGarageDbEntities db           = new GerGarageDbEntities();
            List <VehicleMake>  vehicleMakes = db.VehicleMakes.ToList();

            return(vehicleMakes);
        }
Exemplo n.º 7
0
        public ActionResult SignUp(UserRegisterView regUser)
        {
            using (GerGarageDbEntities db = new GerGarageDbEntities())
            {
                CustomerRegistry user = new CustomerRegistry();

                user.CustomerFirstName  = regUser.CustomerFirstName;
                user.CustomerLastName   = regUser.CustomerLastName;
                user.CustomerContact    = regUser.CustomerContact;
                user.CustomerEmailId    = regUser.CustomerEmailId;
                user.CustomerPassword   = regUser.CustomerPassword;
                user.CustomerAddress    = regUser.CustomerAddress;
                user.CustomerPostalCode = regUser.CustomerPostalCode;

                CustomerLogin logUser = new CustomerLogin();
                logUser.CustomerEmailId  = regUser.CustomerEmailId;
                logUser.CustomerPassword = regUser.CustomerPassword;
                if (ModelState.IsValid)
                {
                    db.CustomerRegistries.Add(user);
                    db.CustomerLogins.Add(logUser);
                    db.SaveChanges();

                    return(RedirectToAction("Login"));
                }
                return(View());
            }
        }
Exemplo n.º 8
0
        public ActionResult Booking()
        {
            GerGarageDbEntities db = new GerGarageDbEntities();

            ViewBag.VehicleList = new SelectList(db.VehicleMakes, "VehicleBrand", "VehicleBrand");
            ViewBag.ServiceList = new SelectList(db.ServicesAvailables, "ServiceName", "ServiceName");

            return(View());
        }
        public ActionResult GenerateInvoice(int id)
        {
            using (GerGarageDbEntities db = new GerGarageDbEntities())
            {
                JobDetail jd = db.JobDetails.FirstOrDefault(c => c.JobNumber == id);

                var report = new PartialViewAsPdf("~/Views/Shared/Invoice.cshtml", jd);
                return(report);
            }
        }
Exemplo n.º 10
0
 public ActionResult Login(RegisteredEmployee regEmp)
 {
     using (var context = new GerGarageDbEntities())
     {
         bool isValid = context.EmployeeLogins.Any(x => x.EmployeeEmailId == regEmp.EmployeeEmailId && x.EmployeePassword == regEmp.EmployeePassword);
         if (isValid)
         {
             FormsAuthentication.SetAuthCookie(regEmp.EmployeeEmailId, false);
             return(RedirectToAction("Index", "Home"));
         }
         ModelState.AddModelError("", "Invalid Login Credentials!!!!");
     }
     return(View());
 }