コード例 #1
0
        public void Add <T>(T temp) where T : class
        {
            if (temp is Person)
            {
                Person a = temp as Person;
                person.Add(a);
                NotifyList?.Invoke("add Person", a.Name);
            }
            else if (temp is Trafic)
            {
                Trafic a = temp as Trafic;
                res.Add(a.NameTr, a);
                NotifyList?.Invoke("add Trafic", a.NameTr);
            }

            else
            {
                throw new InvalidCastException();
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            //Dictionary<string,Trafic> traf = new Dictionary<string,Trafic>();
            Trafic traf1 = new Trafic(100, "Medlenno");
            Trafic traf2 = new Trafic(160, "Sredne");
            Trafic traf3 = new Trafic(250, "Bistro");

            Person pers1    = new Person("perviy", traf1, 500);
            Person pers2    = new Person("vtoroi", traf2, 600);
            Person pers3    = new Person("tretiy", traf3, 800);
            Firma  database = new Firma();

            database.Add <Person>(pers1);
            database.Add <Person>(pers2);
            database.Add <Person>(pers3);
            database.Add <Trafic>(traf1);
            database.Add <Trafic>(traf2);
            database.Add <Trafic>(traf3);

            var del = new Journal();
            //database.NotifyList += del.RegistrationEvent;
            //database.NotifyRegistr += (string about, string name) =>
            //{
            //Console.WriteLine(about);
            //Console.WriteLine(name);
            //};
            Person pers4 = new Person("Olga");

            database.Add <Person>(pers4);

            //del.Info();
            //database.RegistrationTrafic(pers4, traf1, 500);
            database.TarifsNames();
            Console.WriteLine(database.ToSum());
            database.TarifsClient();
            Console.WriteLine(database.Client());
            Console.WriteLine(database.More(600));
            database.Sum();
        }
コード例 #3
0
        //public void SumPers(int a, Trafic Name, Person Name)
        //{

        //}
        public void RegistrationTrafic(Person a, Trafic Traf, int S)
        {
            a.Registration(Traf, S);
            NotifyRegistr?.Invoke("add Trafic", Traf.NameTr);
        }
コード例 #4
0
 public void Registration(Trafic Traf, int Sum)
 {
     this.Traf = Traf;
     this.SumT = Sum;
 }
コード例 #5
0
 public Person(string Name, Trafic Traf, int Sum)
 {
     this.Name = Name;
     this.Traf = Traf;
     this.SumT = Sum;
 }