コード例 #1
0
        static void Delete(hmsbal worker)
        {
            try
            {
                Console.WriteLine("Enter ID to delete");

                int ID = int.Parse(Console.ReadLine());
                foreach (var item in worker.GetAll())
                {
                    // Console.WriteLine(item.RollNo);
                    if (ID == item.ID)
                    {
                        worker.Remove(ID);
                    }
                }
            }
            catch (WorkerNotFoundException ex1)
            {
                Console.WriteLine(ex1.Message);
            }
            catch (Exception ex2)
            {
                Console.WriteLine(ex2.Message);
            }
            //Worker wr = new Worker();
            //int ID = int.Parse(Console.ReadLine());
            //worker.Remove(ID);
        }
コード例 #2
0
        static void Display(hmsbal worker)
        {
            //student.GetAll();

            foreach (var item in worker.GetAll())
            {
                Console.WriteLine(item.ToString());
            }
        }
コード例 #3
0
 static void Display(hmsbal worker)
 {
     //student.GetAll();
     try
     {
         foreach (var item in worker.GetAll())
         {
             Console.WriteLine(item.ToString());
         }
     }
     catch (WorkerNotFoundException ex1)
     {
         Console.WriteLine(ex1.Message);
     }
     catch (Exception ex2)
     {
         Console.WriteLine(ex2.Message);
     }
 }
コード例 #4
0
        static void Modify(hmsbal worker)
        {
            //Student st = new Student();
            //student.Modify(st);

            Worker wr = new Worker();

            Console.WriteLine("Enter ID");
            int ID1 = int.Parse(Console.ReadLine());

            foreach (var item in worker.GetAll())
            {
                // Console.WriteLine(item.RollNo);
                if (ID1 == item.ID)
                {
                    wr = item;
                    worker.Modify(wr);
                }
            }
        }