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 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()
        {
            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 ListForm()
        {
            ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderColor, StrColorList());

            Console.Write(Messages.MessageForReturnToMenu);
            Console.ReadKey();
        }
        public override void ListForm()
        {
            string consoleVal;

            _menuTitle = Messages.ListMenuHeaderCar;
            string[] menuItems = new string[] { "1-List of All Cars", "2-Cars List by Brands", "3-Cars List by Color", "4-Available Cars", "5-Already Rented", "6-RETURN MAIN MENU" };

            ConsoleTexts.WriteConsoleMenuInFrame(_menuTitle, menuItems);

            consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectNumberOfMenuItem);
            if (consoleVal == "")
            {
                consoleVal = "0";
            }
            int selected = Convert.ToInt32(consoleVal);

            switch (selected)
            {
            case 1:
                ListAllCars();
                ListForm();
                break;

            case 2:
                ListByBrands();
                ListForm();
                break;

            case 3:
                ListByColor();
                ListForm();
                break;

            case 4:
                AvailableCars();
                ListForm();
                break;

            case 5:
                Rented();
                ListForm();
                break;

            case 6:
                Menu();
                break;

            default:
                Console.WriteLine(Messages.WrongChoice);
                Menu();
                break;
            }
        }
        private void ListByColor()
        {
            string       consoleVal;
            ColorManager colorManager = MainConsoleManager.GetColorManager().Data;

            ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderColorSelect, _colorScreen.StrColorList());
            //ConsoleTexts.WriteDataList("COLORS", _colorManager.GetAll());
            consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectColorId);
            int colorId = Convert.ToInt32(consoleVal);

            string color             = colorManager.GetById(colorId).Data.Name;
            List <CarDetailDto> cars = _carManager.GetCarDetailsByColorId(colorId).Data;

            ConsoleTexts.WriteDataList(color + Messages.ListHeaderColoredCar, cars);
        }
        public virtual void Menu()
        {
            string consoleVal;

            string[] menuItems = new string[] { "1-Add New Form", "2-Update Form", "3-Delete Form", "4-View Form", "5-RETURN MAIN MENU" };

            ConsoleTexts.WriteConsoleMenuInFrame(_menuTitle, menuItems);

            consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectNumberOfMenuItem);
            if (consoleVal == "")
            {
                consoleVal = "0";
            }
            int selected = Convert.ToInt32(consoleVal);

            switch (selected)
            {
            case 1:
                AddForm();
                Menu();
                break;

            case 2:
                UpdateForm();
                Menu();
                break;

            case 3:
                DeleteForm();
                Menu();
                break;

            case 4:
                ListForm();
                Menu();
                break;

            case 5:
                MainConsoleManager.MainMenu();
                break;

            default:
                Console.WriteLine(Messages.WrongChoice);
                Menu();
                break;
            }
        }
        private void ListByBrands()
        {
            string       consoleVal;
            BrandManager brandManager = MainConsoleManager.GetBrandManager().Data;

            ConsoleTexts.WriteConsoleMenuInFrame(Messages.ListHeaderBrandSelect, _brandScreen.StrBrandList());
            consoleVal = ConsoleTexts.ConsoleWriteReadLine(Messages.SelectBrandId);
            int brandId = Convert.ToInt32(consoleVal);

            string brand             = brandManager.GetById(brandId).Data.Name;
            List <CarDetailDto> cars = _carManager.GetCarDetailsByBrandId(brandId).Data;

            ConsoleTexts.WriteDataList(brand + Messages.ListHeaderBrandedCar, cars);

            Console.Write(Messages.MessageForReturnToMenu);
            Console.ReadKey();
        }
        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);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        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);
                }
            }
        }