Esempio n. 1
0
 public override void RequestApplications(Request request)
 {
     if (request.RequestType == "請假" && request.Number <= 5)
     {
         Console.WriteLine("{0}:{1} 數量{2} 被批准", name, request.RequestContent, request.Number);
     }
     else
     {
         if (superior != null)
             superior.RequestApplications(request);
     }
 }
Esempio n. 2
0
 public override void RequestApplications(Request request)
 {
     if (request.RequestType == "請假")
     {
         Console.WriteLine("{0}:{1} 數量{2} 被批准", name, request.RequestContent, request.Number);
     }
     else if (request.RequestType == "加薪" && request.Number <= 500)
     {
         Console.WriteLine("{0}:{1} 數量{2} 被批准", name, request.RequestContent, request.Number);
     }
     else if (request.RequestType == "加薪" && request.Number > 500)
     {
         Console.WriteLine("{0}:{1} 數量{2} 再說吧", name, request.RequestContent, request.Number);
     }
 }
Esempio n. 3
0
        //得到結果
        public void GetResult(ManagerLevel managerLevel, Request request)
        {
            if (managerLevel == ManagerLevel.經理)
            {
                if (request.RequestType == "請假" && request.Number <= 2)
                {
                    Console.WriteLine("{0}:{1} 數量{2} 被批准", name, request.RequestContent, request.Number);
                }
                else
                {
                    Console.WriteLine("{0}:{1} 數量{2} 我無權處理", name, request.RequestContent, request.Number);
                }

            }
            else if (managerLevel == ManagerLevel.總監)
            {
                if (request.RequestType == "請假" && request.Number <= 5)
                {
                    Console.WriteLine("{0}:{1} 數量{2} 被批准", name, request.RequestContent, request.Number);
                }
                else
                {
                    Console.WriteLine("{0}:{1} 數量{2} 我無權處理", name, request.RequestContent, request.Number);
                }
            }
            else if (managerLevel == ManagerLevel.總經理)
            {
                if (request.RequestType == "請假")
                {
                    Console.WriteLine("{0}:{1} 數量{2} 被批准", name, request.RequestContent, request.Number);
                }
                else if (request.RequestType == "加薪" && request.Number <= 500)
                {
                    Console.WriteLine("{0}:{1} 數量{2} 被批准", name, request.RequestContent, request.Number);
                }
                else if (request.RequestType == "加薪" && request.Number > 500)
                {
                    Console.WriteLine("{0}:{1} 數量{2} 再說吧", name, request.RequestContent, request.Number);
                }
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            CommonManager jinli = new CommonManager("金利");
            Majordomo zongjian = new Majordomo("宗劍");
            GeneralManager zhongjingli = new GeneralManager("鐘精勵");
            jinli.SetSuperior(zongjian);
            zongjian.SetSuperior(zhongjingli);

            Request request = new Request();
            request.RequestType = "請假";
            request.RequestContent = "小菜請假";
            request.Number = 1;
            jinli.RequestApplications(request);

            Request request2 = new Request();
            request2.RequestType = "請假";
            request2.RequestContent = "小菜請假";
            request2.Number = 4;
            jinli.RequestApplications(request2);

            Request request3 = new Request();
            request3.RequestType = "加薪";
            request3.RequestContent = "小菜請求加薪";
            request3.Number = 500;
            jinli.RequestApplications(request3);

            Request request4 = new Request();
            request4.RequestType = "加薪";
            request4.RequestContent = "小菜請求加薪";
            request4.Number = 1000;
            jinli.RequestApplications(request4);

            Console.Read();
        }
Esempio n. 5
0
 //申請請求
 public abstract void RequestApplications(Request request);
Esempio n. 6
0
        static void Main(string[] args)
        {
            Manager jinli = new Manager("金利");
            Manager zongjian = new Manager("宗劍");
            Manager zhongjingli = new Manager("鐘精勵");

            Request request = new Request();
            request.RequestType = "加薪";
            request.RequestContent = "小菜請求加薪";
            request.Number = 1000;

            jinli.GetResult(ManagerLevel.經理, request);
            zongjian.GetResult(ManagerLevel.總監, request);
            zhongjingli.GetResult(ManagerLevel.總經理, request);

            Request request2 = new Request();
            request2.RequestType = "請假";
            request2.RequestContent = "小菜請假";
            request2.Number = 3;

            jinli.GetResult(ManagerLevel.經理, request2);
            zongjian.GetResult(ManagerLevel.總監, request2);
            zhongjingli.GetResult(ManagerLevel.總經理, request2);

            Console.Read();
        }