public ActionResult Index(string id, string article) { if (Session["User_Name"] == null || Session["User_Role"] == null || Convert.ToInt32(Session["User_Role"]) != 1) { return(RedirectToAction("Index", "Home")); } VehiclesDbHandle vehicledbhandle = new VehiclesDbHandle(); UsersDbHandle usersdbhandle = new UsersDbHandle(); LicencesDbHandle licencesdbhandle = new LicencesDbHandle(); if (!string.IsNullOrEmpty(id)) { if (id == "1") { ViewBag.AllUsersCount = usersdbhandle.GetUsers().Count(); ViewBag.AllVehiclesCount = vehicledbhandle.GetAllVehicles().Count(); ViewBag.DisplayDashboard = true; } else if (id == "2") { ViewBag.AllUsers = usersdbhandle.GetUsers(); ViewBag.DisplayManageUsers = true; } else if (id == "3") { ViewBag.AllVehicles = vehicledbhandle.GetAllVehicles(); ViewBag.DisplayManageVehicles = true; } else if (id == "4") { ViewBag.AllLicences = licencesdbhandle.GetLicenceDetails(); ViewBag.DisplayManageLicences = true; } } else { ViewBag.AllUsersCount = usersdbhandle.GetUsers().Count(); ViewBag.AllVehiclesCount = vehicledbhandle.GetAllVehicles().Count(); ViewBag.DisplayDashboard = true; } return(View()); }
public JsonResult UploadUserLicence(string NumberLic, string NameLic, string BirthDateLic, string IssueDateLic, string CategoryLic, HttpPostedFileBase FileLic, VerificationMessages msg) { LicencesDbHandle dbhandle = new LicencesDbHandle(); msg.Result = 0; msg.Message = string.Empty; msg.DisplaySuccess = false; msg.DisplayError = false; msg.NeedToRedirect = false; if (string.IsNullOrEmpty(NumberLic) || string.IsNullOrEmpty(NameLic) || string.IsNullOrEmpty(BirthDateLic) || string.IsNullOrEmpty(IssueDateLic) || string.IsNullOrEmpty(CategoryLic)) { msg.DisplayError = true; msg.Message = "Invalid!"; return(Json(msg)); } string extension = Path.GetExtension(FileLic.FileName); FileLic.SaveAs(Server.MapPath("/Content/images/user_licences/") + Convert.ToString(Session["User_Name"]).Trim() + extension); msg.Result = dbhandle.AddLicence(NameLic, NumberLic, BirthDateLic, IssueDateLic, CategoryLic, Convert.ToString(Session["User_Name"]).Trim(), extension); if (msg.Result == -1) { msg.DisplayError = true; msg.Message = "The licence has been been already added to your account!"; } else { msg.DisplaySuccess = true; msg.Message = "The licence has been successfully added!"; } return(Json(msg)); }
public JsonResult ApproveLicence(string Id, VerificationMessages msg) { LicencesDbHandle dbhandle = new LicencesDbHandle(); msg.Result = 0; msg.Message = string.Empty; msg.DisplaySuccess = false; msg.DisplayError = false; msg.NeedToRedirect = false; if (string.IsNullOrEmpty(Id.Trim())) { msg.DisplayError = true; msg.Message = "Invalid!"; return(Json(msg)); } msg.Result = dbhandle.ApproveLicence(Id.Trim()); msg.DisplaySuccess = true; msg.Message = "The licence has been successfully approved!"; return(Json(msg)); }
public ActionResult Index(string id) { if (Session["User_Name"] == null) { return(RedirectToAction("Index", "Home")); } VehiclesDbHandle vehicledbhandle = new VehiclesDbHandle(); UsersDbHandle dbhandle = new UsersDbHandle(); LicencesDbHandle licdbhandle = new LicencesDbHandle(); List <Users> ListUsers = dbhandle.GetDetailsForSpecificUser(Convert.ToString(Session["User_Name"])); TempData["User_Details"] = ListUsers; var firstordefault = ListUsers.FirstOrDefault(); ViewBag.EmailAddress = firstordefault.User_EmailAddress; ViewBag.Address = firstordefault.User_Address; ViewBag.PostalCode = firstordefault.User_PostalCode; ViewBag.PhoneNumber = firstordefault.User_PhoneNumber; ViewBag.ReservedVehicles = vehicledbhandle.GetReservedVehiclesForSpecificUser(Convert.ToString(Session["User_Name"])); string LicencePath = string.Empty; string CreditCardNumber = string.Empty; bool LicenceApproved = false; if (licdbhandle.HaveLicence(Convert.ToString(Session["User_Name"]), ref LicencePath, ref LicenceApproved)) { ViewBag.HaveLicence = true; ViewBag.LicenceApproved = LicenceApproved; ViewBag.LicencePath = LicencePath; } if (dbhandle.HaveCreditCard(Convert.ToString(Session["User_Name"]), ref CreditCardNumber)) { ViewBag.HaveCreditCard = true; ViewBag.CreditCardNumber = CreditCardNumber; } if (!string.IsNullOrEmpty(id)) { if (id == "1") { ViewBag.DisplayManageProfile = true; } else if (id == "2") { ViewBag.DisplayReservedVehicles = true; } else if (id == "3") { ViewBag.DisplayLicence = true; } else if (id == "4") { ViewBag.DisplayPaymentDetails = true; } } else { ViewBag.DisplayManageProfile = true; } return(View()); }