Exemplo n.º 1
0
        static void Main(string[] args)
        {
            string           objectselect = ConfigurationManager.AppSettings.Get("JsonStaffOperations");
            var              objectType   = Type.GetType(objectselect);
            IStaffOperations staff        = Activator.CreateInstance(objectType) as IStaffOperations;
            List <Staffs>    StaffList    = staff.PopulateList();
            string           select;

            do
            {
                Console.WriteLine("\nENTER '1' FOR DATA ENTRY\nENTER '2' TO VIEW  DETAILS OF ALL STAFF\nENTER '3' TO VIEW STAFF DETAILS IN SPECIFIC\nENTER '4' TO DELETE STAFF DETAILS\nENTER '5' TO UPDATE STAFF DETAILS \nENTER '9' TO EXIT");
                select = Console.ReadLine();
                switch (select)
                {
                case "1":
                    StaffList.Add(StaffOperations.EnterData(StaffList));
                    break;

                case "2":
                    StaffOperations.View(StaffList);
                    break;

                case "3":
                    int viewid = StaffOperations.ReturnId();
                    StaffOperations.ViewOne(viewid, StaffList);
                    break;

                case "4":
                    int deleteid = StaffOperations.ReturnId();
                    StaffOperations.Delete(deleteid, StaffList);
                    break;

                case "5":
                    int updateid = StaffOperations.ReturnId();
                    StaffOperations.UpdateData(updateid, StaffList);
                    break;

                case "9":
                    staff.WriteData(StaffList);
                    Console.WriteLine("PROGRAM ENDED");
                    break;

                default:
                    Console.WriteLine("INVALID OPTION");
                    break;
                }
            }while (select != "9");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string select;

            do
            {
                Console.WriteLine("\nENTER '1' FOR DATA ENTRY\nENTER '2' TO VIEW  DETAILS OF ALL STAFF\nENTER '3' TO VIEW STAFF DETAILS IN SPECIFIC\nENTER '4' TO DELETE STAFF DETAILS\nENTER '5' TO UPDATE STAFF DETAILS \nENTER '9' TO EXIT");
                select = Console.ReadLine();
                switch (select)
                {
                case "1":
                    StaffOperations.EnterData();
                    break;

                case "2":
                    StaffOperations.View();
                    break;

                case "3":
                    Console.WriteLine("ENTER THE STAFF id");
                    int idv = Convert.ToInt32(Console.ReadLine());
                    StaffOperations.ViewOne(idv);
                    break;

                case "4":
                    Console.WriteLine("ENTER THE STAFF id");
                    int idd = Convert.ToInt32(Console.ReadLine());
                    StaffOperations.Delete(idd);
                    break;

                case "5":
                    Console.WriteLine("ENTER THE STAFF id");
                    int idu = Convert.ToInt32(Console.ReadLine());
                    StaffOperations.UpdateData(idu);
                    break;

                case "9":
                    Console.WriteLine("PROGRAM ENDED");
                    break;

                default:
                    Console.WriteLine("INVALID OPTION");
                    break;
                }
            }while (select != "9");
        }