예제 #1
0
 private void PrekiuKatalogas()
 {
     Console.WriteLine("-------Prekiu Katalogas----------");
     foreach (var preke in PrekiuOperacijos.PrekiuKatalogas())
     {
         var pType = preke.GetType();
         var props = pType.GetProperties();
         foreach (PropertyInfo prp in props)
         {
             string propertyName  = prp.Name;
             string propertyValue = prp.GetValue(preke, new object[] { }).ToString();
             Console.Write(propertyName + ": " + propertyValue + ";  ");
         }
         Console.WriteLine();
     }
 }
예제 #2
0
        private void PrekesPardavimas()
        {
            Guid prekesKodas;

            do
            {
                Console.WriteLine("iveskite prekes koda");
                answer = Console.ReadLine();
            }while (!Guid.TryParse(answer, out prekesKodas));

            arEgzistuoja = arEgzistuojaPreke(prekesKodas);

            while (!arEgzistuoja)
            {
                Console.WriteLine("Tokia preke nerasta");
                Console.WriteLine("Kartoti paieska: 1");
                Console.WriteLine("Eiti i pagrindini menu: 2");

                do
                {
                    answer = Console.ReadLine();
                }while (!(int.TryParse(answer, out answerNb) || answerNb > 2));

                if (answerNb == 1)
                {
                    do
                    {
                        Console.WriteLine("iveskite prekes koda");
                        answer = Console.ReadLine();
                    }while (!Guid.TryParse(answer, out prekesKodas));

                    arEgzistuoja = arEgzistuojaPreke(prekesKodas);
                }

                if (answerNb == 2)
                {
                    return;
                }
            }
            PrekiuOperacijos.PrekesPardavimas(prekesKodas);
        }
예제 #3
0
        private void NaujosPrekesPirkimas()
        {
            int  pirkimoKaina;
            int  pardavimoKaina;
            Guid prekesKodas;

            Console.WriteLine("Iveskite siuos prekes duomenis:");
            Console.WriteLine("1. Iveskite prekes pavadinimas:");
            var pavadinimas = Console.ReadLine();

            do
            {
                Console.WriteLine("2. Iveskite prekes pirkimo kaina centais");
                answer = Console.ReadLine();
            }while (!int.TryParse(answer, out pirkimoKaina));

            do
            {
                Console.WriteLine("3. Iveskite prekes pardavimo kaina centais");
                answer = Console.ReadLine();
            }while (!int.TryParse(answer, out pardavimoKaina));

            do
            {
                Console.WriteLine("3. Iveskite prekes unikalu koda");
                answer = Console.ReadLine();
            }while (!Guid.TryParse(answer, out prekesKodas));

            Imone prekesKlientas = SenoNaujoKlientoPasirinkimas();

            var naujaPreke = new Preke()
            {
                Pavadinimas     = pavadinimas,
                PirkimoKaina    = pirkimoKaina,
                PardavimoKaina  = pardavimoKaina,
                UnikalusNumeris = prekesKodas,
                Klientas        = prekesKlientas
            };

            PrekiuOperacijos.PrekesPirkimas(naujaPreke);
        }
예제 #4
0
        private void PrekesPaieska()
        {
            Preke preke;
            Guid  prekesKodas;

            do
            {
                Console.WriteLine("iveskite prekes koda");
                answer = Console.ReadLine();
            }while (!Guid.TryParse(answer, out prekesKodas));

            arEgzistuoja = arEgzistuojaPreke(prekesKodas);

            while (!arEgzistuoja)
            {
                Console.WriteLine("Preke nerasta!");
                Console.WriteLine("Kartoti ivedima: 1");
                Console.WriteLine("Iseiti: 2");

                do
                {
                    answer = Console.ReadLine();
                }while (!int.TryParse(answer, out answerNb));

                if (answerNb == 1)
                {
                    arEgzistuoja = arEgzistuojaPreke(prekesKodas);
                }

                if (answerNb == 2)
                {
                    return;
                }
            }

            preke = PrekiuOperacijos.PrekesGavimas(prekesKodas);
            Console.WriteLine(preke.ToString());
        }
예제 #5
0
        private void EsamosPrekesPirkimas()
        {
            Guid prekesKodas;

            do
            {
                do
                {
                    Console.WriteLine("iveskite prekes koda");
                    answer = Console.ReadLine();
                }while (!Guid.TryParse(answer, out prekesKodas));

                arEgzistuoja = arEgzistuojaPreke(prekesKodas);

                if (arEgzistuoja)
                {
                    Preke nupirktapreke = PrekiuOperacijos.PrekesGavimas(prekesKodas);
                    PrekiuOperacijos.PrekesPirkimas(nupirktapreke);
                }

                if (!arEgzistuoja)
                {
                    Console.WriteLine("Preke nerasta!");
                    Console.WriteLine("Kartoti prekes paieska: 1");
                    Console.WriteLine("Prideti nauja preke: 2");
                    do
                    {
                        answer = Console.ReadLine();
                    }while (!(int.TryParse(answer, out answerNb) || answerNb > 3));

                    if (answerNb == 2)
                    {
                        NaujosPrekesPirkimas();
                        arEgzistuoja = true;
                    }
                }
            }while (!arEgzistuoja);
        }
예제 #6
0
 private bool arEgzistuojaPreke(Guid unikalusNumeris)
 {
     return(PrekiuOperacijos.ArEgzistuojaPreke(unikalusNumeris));
 }