Exemple #1
0
        static void Main(string[] args)
        {
            string[]   lines    = Read();
            Persoane[] persoana = new Persoane[lines.Length];
            Agenda[]   agenda   = new Agenda[lines.Length];


            for (int i = 0; i < lines.Length; i++)
            {
                persoana[i] = Persoane.CreatePerson(lines[i]);
                listaPersoane.Add(persoana[i]);
                agenda[i] = Agenda.CreateAgenda(persoana[i]);
                listaAgende.Add(agenda[i]);
            }

            //Console.WriteLine(pers[0].FullName);
            //Console.WriteLine(pers[0].DataNastere);
            //Console.WriteLine(pers[0].Email);

            Activitati alergat = Agenda.Create(agenda[0], "Alergat", "Alerg prin parc", new DateTime(2020, 01, 01, 10, 00, 01), new DateTime(2020, 01, 01, 11, 00, 01));
            Activitati citit   = Agenda.Create(agenda[0], "Citit", "Carti despre c#", new DateTime(2020, 01, 02, 12, 11, 11), new DateTime(2020, 01, 02, 15, 02, 02));

            Agenda.Add(persoana[1], alergat);
            Agenda.Add(persoana[1], citit);
            Agenda.Add(persoana[2], alergat);
            Agenda.Add(persoana[0], citit);
            Agenda.Remove(persoana[0], citit);
            Agenda.Delete(alergat);
            Agenda.CautareNume(persoana[2], "alergat");
            Agenda.CautareInterval(persoana[0], new DateTime(2020, 01, 01, 09, 00, 00), new DateTime(2020, 01, 01, 12, 00, 01));
            Agenda.Meeting(3, persoana);

            Console.ReadKey();
        }
Exemple #2
0
        public static Activitati Create(Agenda agenda, string nume, string descriere, DateTime start, DateTime end)
        {
            Activitati activitate = new Activitati(nume, descriere, start, end);

            activitate.Participanti = new List <Persoane>();

            Console.WriteLine("Activitate creata: {0}", activitate.Show());
            agenda.listaActivitati.Add(activitate);
            return(activitate);
        }
Exemple #3
0
        public static Activitati Remove(Persoane persoana, Activitati activitate)
        {
            if (persoana.agenda == null)
            {
                return(activitate);
            }

            persoana.agenda.listaActivitati.Remove(activitate);
            Console.WriteLine("Activitate eliminata din agenda lui {0}: {1}", persoana.FullName, activitate.Show());
            return(activitate);
        }
Exemple #4
0
        public static Activitati Add(Persoane persoane, Activitati activitate)
        {
            if (persoane.agenda == null)
            {
                CreateAgenda(persoane);
            }

            persoane.agenda.listaActivitati.Add(activitate);
            Console.WriteLine("Activitate adaugata in agenda lui {0}: {1}", persoane.FullName, activitate.Show());
            return(activitate);
        }
Exemple #5
0
        public static Activitati Delete(Activitati activitate)
        {
            foreach (Persoane person in activitate.Participanti)
            {
                Remove(person, activitate);
            }

            activitate.Participanti.Clear();

            Console.WriteLine("Activitate stearsa: {0}", activitate.Show());
            return(activitate);
        }
Exemple #6
0
        public static Activitati Meeting(int durata, Persoane[] persoane)
        {
            DateTime timp = new DateTime();


            Activitati meeting = new Activitati("Meeting", "Discutii despre proiecte", timp, timp.AddHours(durata));

            meeting.Participanti = persoane.ToList();


            foreach (Persoane aux in persoane)
            {
                if (aux.agenda != null)
                {
                    foreach (Activitati activity in aux.agenda.listaActivitati)
                    {
                        if (activity.dataSfarsit > timp)
                        {
                            timp = activity.dataIncepere;
                        }
                    }
                }
            }

            meeting.dataIncepere = timp;
            meeting.dataSfarsit  = timp.AddHours(durata);

            Console.WriteLine("Urmatoarea intalnire: {0}", meeting.Show());

            foreach (Persoane aux in persoane)
            {
                aux.agenda.listaActivitati.Add(meeting);
            }

            return(meeting);
        }