public override void AddForm() { Car car = new Car(); string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderCarAddNew); ConsoleTexts.FrameHeaderFooterLine(); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeCarName); car.CarName = consoleVal; ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderBrandSelect, _brandScreen.StrBrandList()); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectBrandId); car.BrandId = Convert.ToInt32(consoleVal); ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderColorSelect, _colorScreen.StrColorList()); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectColorId); car.ColorId = Convert.ToInt32(consoleVal); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeModelYear); car.ModelYear = Convert.ToInt16(consoleVal); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeDailyPrice); car.DailyPrice = Convert.ToDecimal(consoleVal); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeDescription); car.Description = consoleVal; _carManager.Add(car); }
public override void UpdateForm() { Car car; string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderCarUpdate); ConsoleTexts.FrameHeaderFooterLine(); ListAllCars(); if (_carManager.Count().Data > 0) { consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectCarIdToUpdate); car = _carManager.GetById(Convert.ToInt32(consoleVal)).Data; consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeCarName + Messages.LeaveBlank); car.CarName = consoleVal; if (consoleVal != "") { car.CarName = consoleVal; } ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderBrandSelect, _brandScreen.StrBrandList()); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectBrandId + Messages.LeaveBlank); if (consoleVal != "") { car.BrandId = Convert.ToInt32(consoleVal); } ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderColorSelect, _colorScreen.StrColorList()); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectColorId + Messages.LeaveBlank); if (consoleVal != "") { car.ColorId = Convert.ToInt32(consoleVal); } consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeModelYear + Messages.LeaveBlank); if (consoleVal != "") { car.ModelYear = Convert.ToInt16(consoleVal); } consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeDailyPrice + Messages.LeaveBlank); if (consoleVal != "") { car.DailyPrice = Convert.ToDecimal(consoleVal); } consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeDescription + Messages.LeaveBlank); if (consoleVal != "") { car.Description = consoleVal; } _carManager.Update(car); } else { Menu(); } }
public override void DeleteForm() { string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderRentalDelete); ConsoleTexts.FrameHeaderFooterLine(); List <RentalDetailDto> rentals = RentalList(); string[] headers = { "Rental ID", "Car Name", "Brand Name", "Color Name", "First Name", "Last Name", "Email Address", "Company Name", "Rent Date", "Return Date" }; //Todo : Liste sütunlarını azalt ConsoleTexts.WriteDataList <RentalDetailDto>(Messages.ListHeaderRentalSelect, rentals, headers); if (rentals != null) { consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectRentalIdToDelete); if (consoleVal != "") { Rental rental = _rentalManager.GetById(Convert.ToInt32(consoleVal)).Data; if (ConsoleTexts.ConfirmAction(Messages.DeleteItemAttention)) { _rentalManager.Delete(rental); } } } }
public override void UpdateForm() { Color color; string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderColorUpdate); ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderColorSelect, StrColorList()); if (StrColorList() != null) { consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectColorIdToUpdate); if (consoleVal != "") { color = _colorManager.GetById(Convert.ToInt32(consoleVal)).Data; consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeColorName + Messages.LeaveBlank); if (consoleVal != "") { color.Name = consoleVal; } _colorManager.Update(color); } } }
public override void AddForm() { Rental rental = new Rental(); string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderRentalAddNew); ConsoleTexts.FrameHeaderFooterLine(); string[] headers = { "Car ID", "Car Name", "Brand Name", "Color Name", "Model Year", "Daily Price", "Description" }; ConsoleTexts.WriteDataList <CarDetailDto>(Messages.ListHeaderCarSelect, _carScreen.RentableCarList(), headers); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectCarId); rental.CarId = Convert.ToInt32(consoleVal); ConsoleTexts.WriteDataList <CustomerDetailDto>(Messages.ListHeaderCustomerSelect, _customerScreen.CustomerList()); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectCustomerId); rental.CustomerId = Convert.ToInt32(consoleVal); Console.Write(Messages.TypeRentalDate); consoleVal = Console.ReadLine(); DateTime rentDate; while (!DateTime.TryParseExact(consoleVal, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out rentDate)) { Console.WriteLine(Messages.InvalidDate); consoleVal = Console.ReadLine(); } rental.RentStartDate = rentDate; //rental.ReturnDate = null; Console.WriteLine(_rentalManager.Add(rental).Message); }
public override void UpdateForm() { string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderRentalDelete); ConsoleTexts.FrameHeaderFooterLine(); List <RentalDetailDto> rentals = RentalList(); string[] mainHeaders = { "Rental ID", "Car Name", "Brand Name", "Color Name", "First Name", "Last Name", "Email Address", "Company Name", "Rent Date", "Return Date" }; //Todo : Liste sütunlarını azalt ConsoleTexts.WriteDataList <RentalDetailDto>(Messages.ListHeaderRentalSelect, rentals, mainHeaders); if (rentals != null) { consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectRentalIdToUpdate); if (consoleVal != "") { Rental rental = new Rental(); rental = _rentalManager.GetById(Convert.ToInt32(consoleVal)).Data; string[] headers = { "Car ID", "Car Name", "Brand Name", "Color Name", "Model Year", "Daily Price", "Description" }; ConsoleTexts.WriteDataList <CarDetailDto>(Messages.ListHeaderCarSelect, _carScreen.RentableCarList(), headers); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectCarId); rental.CarId = Convert.ToInt32(consoleVal); ConsoleTexts.WriteDataList <CustomerDetailDto>(Messages.ListHeaderCustomerSelect, _customerScreen.CustomerList()); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectCustomerId); rental.CustomerId = Convert.ToInt32(consoleVal); Console.Write(Messages.TypeRentalDate); consoleVal = Console.ReadLine(); DateTime rentDate; while (!DateTime.TryParseExact(consoleVal, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out rentDate)) { Console.WriteLine(Messages.InvalidDate); consoleVal = Console.ReadLine(); } rental.RentStartDate = rentDate; Console.Write(Messages.TypeRentalDate); consoleVal = Console.ReadLine(); DateTime returnDate; while (!DateTime.TryParseExact(consoleVal, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out returnDate)) { Console.WriteLine(Messages.InvalidDate); consoleVal = Console.ReadLine(); } rental.ReturnDate = returnDate; _rentalManager.Update(rental); } } }
public override void AddForm() { Brand brand = new Brand(); string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderBrandAddNew); ConsoleTexts.FrameHeaderFooterLine(); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeBrandName); brand.Name = consoleVal; _brandManager.Add(brand); }
public override void AddForm() { Color color = new Color(); string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderColorAddNew); ConsoleTexts.FrameHeaderFooterLine(); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeColorName); color.Name = consoleVal; _colorManager.Add(color); }
public override void AddForm() { Customer customer = new Customer(); string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderCustomerAddNew); ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.WriteDataList(Messages.ListHeaderUserSelect, _userScreen.UserList()); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectUserId); customer.UserId = Convert.ToInt32(consoleVal); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeCustomerCompanyName); customer.CompanyName = consoleVal; _customerManager.Add(customer); }
public override void DeleteForm() { Car car; string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderCarDelete); ConsoleTexts.FrameHeaderFooterLine(); ListAllCars(); if (_carManager.Count().Data > 0) { consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectCarIdToDelete); if (consoleVal != "") { car = _carManager.GetById(Convert.ToInt32(consoleVal)).Data; if (ConsoleTexts.ConfirmAction(Messages.DeleteItemAttention)) { _carManager.Delete(car); } } } }
public override void DeleteForm() { Color color; string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderColorDelete); ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderColorSelect, StrColorList()); if (StrColorList() != null) { consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectColorIdToDelete); if (consoleVal != "") { color = _colorManager.GetById(Convert.ToInt32(consoleVal)).Data; if (ConsoleTexts.ConfirmAction(Messages.DeleteItemAttention)) { _colorManager.Delete(color); } } } }
public override void DeleteForm() { Brand brand; string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderBrandDelete); ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderBrandSelect, StrBrandList()); if (StrBrandList() != null) { consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectBrandIdToDelete); if (consoleVal != "") { brand = _brandManager.GetById(Convert.ToInt32(consoleVal)).Data; if (ConsoleTexts.ConfirmAction(Messages.DeleteItemAttention)) { _brandManager.Delete(brand); } } } }
public override void AddForm() { User user = new User(); string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderUserAddNew); ConsoleTexts.FrameHeaderFooterLine(); consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeUserFirstName); user.FirstName = consoleVal; consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeUserLastName); user.LastName = consoleVal; consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeUserEmail); user.Email = consoleVal; bool confirm = false; string password = null; while (!confirm) { consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeUserPassword); password = consoleVal; consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeUserConfirmPassword); string confirmPassword = consoleVal; confirm = (password != null && password == confirmPassword) ? true : false; Console.WriteLine(Messages.NotComfirmPassword); } user.PasswordHash = Encoding.ASCII.GetBytes(new string(' ', 100)); //Bu alan sonradan değiştirildiği için artık geçici bir atama yaptım user.PasswordSalt = Encoding.ASCII.GetBytes(new string(' ', 100)); //Bu alan da sonradan oluşturuldu _userManager.Add(user); }
public override void UpdateForm() { Brand brand; string consoleVal; ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.Header(Messages.FormHeaderBrandUpdate); ConsoleTexts.FrameHeaderFooterLine(); ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderBrandSelect, StrBrandList()); if (StrBrandList() != null) { consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectBrandIdToUpdate); if (consoleVal != "") { brand = _brandManager.GetById(Convert.ToInt32(consoleVal)).Data; consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.TypeBrandName + Messages.LeaveBlank); if (consoleVal != "") { brand.Name = consoleVal; } _brandManager.Update(brand); } } }