Exemplo n.º 1
0
        // Patikrinimas ar transporto priemones numeris neegzistuoja
        public Tuple <bool, string> NotMatchingVehNumber()
        {
            List <Car>        cars  = SqlQueries.SelectCars();
            List <Motorcycle> motos = SqlQueries.SelectMotorcycles();

            Console.Clear();
            Console.CursorVisible = true;
            Console.WriteLine("Ivesk transporto priemones valstybini numeri");
            vehNumber = Console.ReadLine().ToUpper();
            while (!lettersAndNums.IsMatch(vehNumber) || vehNumber == "")
            {
                Console.WriteLine($"\nValstybini numeri gali sudaryti tik raides ir skaitmenys!\nIvesk transporto priemones valstybini numeri");
                vehNumber = Console.ReadLine().ToUpper();
            }
            var checkResultCars  = cars.Select(c => c.VehNumber).Contains(vehNumber);
            var checkResultMotos = motos.Select(m => m.VehNumber).Contains(vehNumber);

            if (checkResultCars || checkResultMotos)
            {
                Console.Clear();
                Console.WriteLine("Transporto priemone su tokiu numeriu jau egzistuoja");
                Console.ReadKey();

                isDataCorrect = false;
            }
            else
            {
                isDataCorrect = true;
            }

            return(new Tuple <bool, string>(isDataCorrect, vehNumber));
        }
Exemplo n.º 2
0
        // Automobilio dokumentu galiojimo laiko redagavimas su ivedamu duomenu patikrinimu
        public Tuple<string, string> EditCarDocsData(string vehNumber)
        {
            List<Car> cars = SqlQueries.SelectCars();

            var result = cars.Select(c => c).Where(c => c.VehNumber == vehNumber);
            
            Console.WriteLine("Ivesk iki kada galioja automobilio TA");
            car.TechServiceExp = Console.ReadLine();
            if (car.TechServiceExp == "")
            {
                foreach (var car in result)
                {
                    techServiceExp = car.TechServiceExp;
                    Console.SetCursorPosition(0, Console.CursorTop - 1);
                    Console.WriteLine(techServiceExp);
                }
            }
            else
            {
                while (!date.IsMatch(car.TechServiceExp) || car.TechServiceExp == "")
                {
                    Console.WriteLine($"\nIvedimui naudok tik skaicius, tasko(.) ir bruksnio(-) simbolius! Ivesk iki kada galioja TA");
                    car.TechServiceExp = Console.ReadLine();                    
                }
                techServiceExp = car.TechServiceExp;
            }

            Console.WriteLine("Ivesk iki kada galioja automobilio draudimas");
            car.InsuranceExp = Console.ReadLine();
            if (car.InsuranceExp == "")
            {
                foreach (var car in result)
                {
                    insuranceExp = car.InsuranceExp;
                }
            }
            else
            {
                while (!date.IsMatch(car.InsuranceExp) || car.InsuranceExp == "")
                {
                    Console.WriteLine($"\nIvedimui naudok tik skaicius, tasko(.) ir bruksnio(-) simbolius! Ivesk iki kada galioja draudimas");
                    car.InsuranceExp = Console.ReadLine();
                }
                insuranceExp = car.InsuranceExp;
            }

            Console.Clear();
            Console.WriteLine("Duomenys sekmingai atnaujinti");
            Console.ReadKey();

            return new Tuple<string, string>(techServiceExp, insuranceExp);
        }