public ViewResult DeleteService(string Name, string Nickname) { List <string> output = new List <string>(); foreach (var service in servicesRepository.Services) { DateTime res; DateTime.TryParse(service.Data, out res); if (res >= DateTime.Now) { output.Add(service.Samolot + " " + service.Data + " " + service.By); } } SelectList serviceList = new SelectList(output); PlaneListViewModel viewModel = new PlaneListViewModel { Name = Name, NickName = Nickname, ServiceList = serviceList }; return(View(viewModel)); }
public ViewResult AddManuallyService(string Name, string Nickname) { List <string> output = new List <string>(); foreach (var user in userRepository.Users) { if (user.Role == "Mechanic") { output.Add(user.Name); } } SelectList List = new SelectList(output); List <string> output1 = new List <string>(); foreach (var plane in repository.Samoloty) { output1.Add(plane.Nazwa); } SelectList PlaneList = new SelectList(output1); PlaneListViewModel viewModel = new PlaneListViewModel() { Name = Name, NickName = Nickname, ListaSamolotów = PlaneList, MechanicList = List }; return(View(viewModel)); }
public ActionResult DeleteServiceFromRepository(string Link, string Name, string Nickname) { string[] Parts = Link.Split(' '); servicesRepository.DeleteService(Parts[0], Parts[1], Parts[2]); List <string> output = new List <string>(); foreach (var service in servicesRepository.Services) { output.Add(service.Samolot + " " + service.Data + " " + service.By); } SelectList serviceList = new SelectList(output); PlaneListViewModel viewModel = new PlaneListViewModel { Name = Name, NickName = Nickname, ServiceList = serviceList }; TempData["deletemanuallyservice"] = "Został poprawnie usunięty serwis , dnia " + Parts[1]; return(View("DeleteService", viewModel)); }
public HomeViewModel() { PageTitle = "Home"; PlaneListViewModel = new PlaneListViewModel(); ScriptListViewModel = new ScriptListViewModel(); ExecutionViewModel = new ExecutionViewModel(); }
public ActionResult AddManuallyUser(string Name, string NickName) { PlaneListViewModel viewModel = new PlaneListViewModel { Name = Name, NickName = NickName }; return(View(viewModel)); }
public PartialViewResult NavigationBar(string Name, string Nickname) { PlaneListViewModel viewModel = new PlaneListViewModel { Name = Name, NickName = Nickname }; return(PartialView(viewModel)); }
public ViewResult PlaneList(string Name, string Nickname) { PlaneListViewModel viewModel = new PlaneListViewModel { Name = Name, NickName = Nickname, Samoloty = repository.Samoloty }; return(View(viewModel)); }
public ActionResult AddManualyReservation(string Name, string Nickname) { PlaneListViewModel viewModel = new PlaneListViewModel { Name = Name, NickName = Nickname }; return(RedirectToAction("Rezerwacja", "Reservation", viewModel)); }
public ViewResult Reservations(string Name, string Nickname) { PlaneListViewModel reservations = new PlaneListViewModel { Reservations = reservationRepository.reservations, Name = Name, NickName = Nickname }; return(View(reservations)); }
public ActionResult Index(string Name, string NickName) { PlaneListViewModel viewModel = new PlaneListViewModel { Samoloty = repository.Samoloty, Reservations = null, Serwis = repository1.Services, Name = Name, NickName = NickName }; return(View(viewModel)); }
public ViewResult ReservationHistory(string Name, string Nickname) { PlaneListViewModel viewModel = new PlaneListViewModel { Samoloty = null, Reservations = reservationRepository.reservations, Name = Name, NickName = Nickname, }; return(View(viewModel)); }
public ViewResult PlaneServices(string Name, string Nickname) { PlaneListViewModel viewModel = new PlaneListViewModel { Samoloty = repository.Samoloty, Serwis = servicesRepository.Services, Name = Name, NickName = Nickname, }; return(View(viewModel)); }
public ViewResult GetHisReservations(string Name, string NickName) { PlaneListViewModel viewModel = new PlaneListViewModel { Samoloty = null, Reservations = reservationRepository.reservations, Name = Name, NickName = NickName, Serwis = servicesRepository.Services }; return(View(viewModel)); }
public ActionResult AddServiceToPlane(string Name, string NickName) { List <string> output = new List <string>(); foreach (var samolot in repository.Samoloty) { output.Add(samolot.Nazwa); } SelectList Lista = new SelectList(output); PlaneListViewModel viewModel = new PlaneListViewModel { Samoloty = repository.Samoloty, ListaSamolotów = Lista, Name = Name, NickName = NickName }; return(View(viewModel)); }
public ViewResult AddServiceToRepostory(string Plane, string Mechanic, string Date, string Name, string Nickname) { Service service = new Service(); service.Data = Date; service.By = Mechanic; service.Samolot = Plane; service.Id = 0; servicesRepository.AddService(service); List <string> output = new List <string>(); foreach (var user in userRepository.Users) { if (user.Role == "Mechanic") { output.Add(user.Name); } } SelectList List = new SelectList(output); List <string> output1 = new List <string>(); foreach (var plane in repository.Samoloty) { output1.Add(plane.Nazwa); } SelectList PlaneList = new SelectList(output1); PlaneListViewModel viewModel = new PlaneListViewModel() { Name = Name, NickName = Nickname, ListaSamolotów = PlaneList, MechanicList = List }; TempData["addmanuallyservice"] = "Dodano servis , dnia " + Date + " , mechanikowi " + Mechanic.Replace("_", " ") + " , dla samolotu " + Plane.Replace("_", " ") + "."; return(View("AddManuallyService", viewModel)); }
public ActionResult RezerwacjaNaNaprawe(string PlaneName, string Date, string WhyIsServiced, string Name, string NickName) { Service dbEntry = new Service(); dbEntry.Samolot = PlaneName; dbEntry.Data = Date; dbEntry.By = Name; dbEntry.Id = 0; dbEntry.WhyIsServiced = WhyIsServiced; List <string> output = new List <string>(); foreach (var samolot in repository.Samoloty) { output.Add(samolot.Nazwa); } SelectList Lista = new SelectList(output); PlaneListViewModel planeListViewModel = new PlaneListViewModel { Name = Name, NickName = NickName, Samoloty = repository.Samoloty, ListaSamolotów = Lista, Serwis = repository1.Services }; if (DateTime.ParseExact(Date, "dd.MM.yyyy", CultureInfo.InvariantCulture) < DateTime.Today) { TempData["mechanicmessage"] = "Nie można dodać rezerwacji serwisu , starszej od dnia dzisiejszego!"; return(View("AddServiceToPlane", planeListViewModel)); } else { repository1.AddService(dbEntry); TempData["mechanicmessage"] = "Dodano rezerwacje terminu na servis samolotu " + PlaneName + " , w dniu " + Date; return(View("AddServiceToPlane", planeListViewModel)); } }
public ActionResult AddPlaneToReposiotry(string NazwaSamolotu, string Przebieg, string Name, string Nickname) { Plane samolot = new Plane(); samolot.Nazwa = NazwaSamolotu.Replace(" ", "_"); int outs; Int32.TryParse(Przebieg, out outs); samolot.WylataneGodziny = outs; repository.AddPlane(samolot); PlaneListViewModel viewModel = new PlaneListViewModel { Name = Name, NickName = Nickname }; TempData["addplanemessage"] = "Poprawnie dodano samolot o nazwie " + samolot.Nazwa.Replace("_", " ") + " o przebiegu wynoszącym " + samolot.WylataneGodziny + " godzin."; return(View("AddPlane", viewModel)); }
public ActionResult DeletePlaneFromRepository(string PlaneName, string Name, string Nickname) { repository.DeletePlane(PlaneName); List <string> output = new List <string>(); foreach (var samolot in repository.Samoloty) { output.Add(samolot.Nazwa); } SelectList Lista = new SelectList(output); PlaneListViewModel viewModel = new PlaneListViewModel() { Name = Name, NickName = Nickname, ListaSamolotów = Lista }; TempData["deleteplanemessage"] = "Usunięto samolot o nazwie: " + PlaneName.Replace("_", " ") + " !"; return(View("DeletePlane", viewModel)); }
public ViewResult Index(string Name, string NickName, string PlaneName, bool?All, string Date) { DateTime Dates = new DateTime(); if (DateTime.TryParseExact(Date, "dd.MM.yyyy", null, DateTimeStyles.None, out Dates) == false) { DateTime.TryParseExact(Date, "yyyy-MM-dd", null, DateTimeStyles.None, out Dates); } else { DateTime.TryParseExact(Date, "dd.MM.yyyy", null, DateTimeStyles.None, out Dates); } List <string> output = new List <string>(); foreach (var samolot in repository.Samoloty) { output.Add(samolot.Nazwa); } SelectList Lista = new SelectList(output); if (All == true) { if (String.IsNullOrEmpty(Date) == true) { TempData["message"] = "Nie wybrano terminu!"; PlaneListViewModel viewModel3 = new PlaneListViewModel { Samoloty = null, Reservations = null, Name = Name, NickName = NickName, Serwis = null, ListaSamolotów = Lista, PlaneName = null }; return(View(viewModel3)); } if (Dates.Date <= DateTime.Today.Date) { TempData["message"] = "Nie możesz wybrać terminu , starszego od dnia dzisiejszego!"; PlaneListViewModel viewModel1 = new PlaneListViewModel { Samoloty = null, Reservations = null, Name = Name, NickName = NickName, Serwis = null, ListaSamolotów = Lista, PlaneName = null }; return(View(viewModel1)); } else { PlaneListViewModel viewModel1 = new PlaneListViewModel { Samoloty = repository.Samoloty, Name = Name, NickName = NickName, Serwis = servicesRepository.Services, ListaSamolotów = null, Date = Dates }; return(View(viewModel1)); } } else if (String.IsNullOrWhiteSpace(PlaneName) == false && String.IsNullOrWhiteSpace(Date) == false) { if (Dates.Date <= DateTime.Today.Date) { TempData["message"] = "Nie możesz wybrać terminu , starszego od dnia dzisiejszego!"; PlaneListViewModel viewModel1 = new PlaneListViewModel { Samoloty = null, Reservations = null, Name = Name, NickName = NickName, Serwis = null, ListaSamolotów = Lista, PlaneName = null }; return(View(viewModel1)); } else { foreach (var samolot in repository.Samoloty) { if (samolot.Nazwa == PlaneName) { PlaneListViewModel Model = new PlaneListViewModel { PlaneName = samolot.Nazwa, Reservations = null, Name = Name, NickName = NickName, Serwis = servicesRepository.Services, Date = Dates }; // throw new Exception(Model.ToString()); return(View(Model)); } } } } PlaneListViewModel viewModel = new PlaneListViewModel { Samoloty = null, Reservations = null, Name = Name, NickName = NickName, Serwis = null, ListaSamolotów = Lista, PlaneName = null }; return(View(viewModel)); }