예제 #1
0
        public static List <FilmCollection> ReadDate(string path)
        {
            List <FilmCollection> g = new List <FilmCollection>();
            string text             = "";

            using (StreamReader sr = new StreamReader(path))
            {
                text = sr.ReadToEnd();
            }
            string[] Dates = text.Split('/');
            foreach (string s in Dates)
            {
                string[] MetaDete = s.Split('|');
                if (MetaDete.Length == 5)
                {
                    FilmCollection d = new FilmCollection
                    {
                        Name     = MetaDete[0].Trim(),
                        LastName = MetaDete[1],
                        DateOut  = DateTime.ParseExact(MetaDete[2], "dd.MM.yyyy", CultureInfo.InvariantCulture),
                        FilmTime = (float)Convert.ToDouble(MetaDete[3]),
                        Budget   = Convert.ToInt32(MetaDete[4])
                    };
                    g.Add(d);
                }
            }
            return(g);
        }
예제 #2
0
        static void Add(List <FilmCollection> v)
        {
            FilmCollection New = new FilmCollection();

            Console.WriteLine("Enter name");
            New.Name = Console.ReadLine();
            Console.WriteLine("Enter Produser Name");
            New.LastName = Console.ReadLine();
            Console.WriteLine("Enter Date out");
            New.DateOut = DateTime.ParseExact(Console.ReadLine(), "dd.MM.yyyy", CultureInfo.InvariantCulture);
            Console.WriteLine("Enter Film time");
            try
            {
                New.FilmTime = (float)Convert.ToDouble(Console.ReadLine());
            }
            catch
            {
            }
            Console.WriteLine("Enter Budget");
            New.Budget = Convert.ToInt32(Console.ReadLine());
            v.Add(New);
        }
예제 #3
0
        static void ChangeData(List <FilmCollection> v)
        {
            Console.WriteLine("Enter name to change");
            string name = Console.ReadLine();

            if ((v.FindIndex(f => f.Name == name) != -1))
            {
                FilmCollection Change = v[v.FindIndex(f => f.Name == name)];
                Console.WriteLine("1)Name\n2)Produser Name\n3)Date out\n4)Film time\n5)Budget");
                var res = Console.ReadKey().KeyChar;
                Console.WriteLine("Enter new value");
                if (res == '1')
                {
                    Change.Name = Console.ReadLine();
                }
                if (res == '2')
                {
                    Change.LastName = Console.ReadLine();
                }
                if (res == '3')
                {
                    Change.DateOut = DateTime.ParseExact(Console.ReadLine(), "dd.MM.yyyy", CultureInfo.InvariantCulture);
                }
                if (res == '4')
                {
                    Change.FilmTime = Convert.ToInt16(Console.ReadLine());
                }
                if (res == '5')
                {
                    Change.Budget = Convert.ToInt16(Console.ReadLine());
                }
            }
            else
            {
                Console.WriteLine("Entered name not found");
                Console.ReadKey();
            }
        }