Пример #1
0
        public void Handle(PoliceOfficerDied message)
        {
            Console.WriteLine("Department: New police officer {0} arrived in heaven.", message.Name);

            var officer = new PoliceOfficer(message.Identification, message.Name);

            Departments.RegisterOfficer(officer);
        }
        public void Handle(DeadPoliceOfficerRecruited message)
        {
            PoliceOfficer officer = Departments.HuntDeados(message.Identification);

            this.Bus.Send <HuntDeadosOnEarth>(
                m =>
            {
                m.PoliceOfficer = officer.Identification;
                m.Name          = officer.Name;
            });
        }
Пример #3
0
        public static void RecruitByMildredProctor(PoliceOfficer officer)
        {
            Console.WriteLine("Department: Check officer {0} by Mildred Proctor.", officer.Name);
            if (random.Next(2) == 0)
            {
                Console.WriteLine("Department: Mildred Proctor is recruiting {0}.", officer.Name);

                officer.Recruit();

                Console.WriteLine("Department: Mildred Proctor has recruited {0}.", officer.Name);

                officers.AddOrUpdate(officer.Identification, k => officer, (k, o) => officer);
            }
        }
        public static void RecruitByMildredProctor(PoliceOfficer officer)
        {
            Console.WriteLine("Department: Check officer {0} by Mildred Proctor.", officer.Name);
            if (random.Next(2) == 0)
            {
                Console.WriteLine("Department: Mildred Proctor is recruiting {0}.", officer.Name);

                officer.Recruit();

                Console.WriteLine("Department: Mildred Proctor has recruited {0}.", officer.Name);

                officers.AddOrUpdate(officer.Identification, k => officer, (k, o) => officer);
            }
        }
        public void Handle(AscendToHeaven message)
        {
            PoliceOfficer officer = Departments.SelectForRecruitment(message.PoliceOfficer);

            if (officer == null)
            {
                return;
            }

            Departments.RecruitByMildredProctor(officer);

            if (officer.IsRecruited)
            {
                this.Bus.SendLocal <DeadPoliceOfficerRecruited>(
                    m =>
                {
                    m.Identification = officer.Identification;
                    m.Name           = officer.Name;
                });
            }
        }
Пример #6
0
        public static void RegisterOfficer(PoliceOfficer officer)
        {
            Console.WriteLine("Department: Registering arrived officer {0}.", officer.Name);

            officers.AddOrUpdate(officer.Identification, k => officer, (k, o) => officer);
        }
        public static void RegisterOfficer(PoliceOfficer officer)
        {
            Console.WriteLine("Department: Registering arrived officer {0}.", officer.Name);

            officers.AddOrUpdate(officer.Identification, k => officer, (k, o) => officer);
        }