示例#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));
        }
示例#2
0
        // Motociklo TA ir draudimo galiojimo datos redagavimas su ivedimo tikrinimu
        public Tuple <string, string> EditMotoDocsData(string vehNumber)
        {
            List <Motorcycle> motos = SqlQueries.SelectMotorcycles();

            var result = motos.Select(m => m).Where(m => m.VehNumber == vehNumber);

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

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

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

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