Exemplo n.º 1
0
        private static void AdminManagerf()
        {
            try
            {
                string        u, p;
                int           eidf, ch;
                bool          status = false, loginn = false;
                Admin         e  = new Admin();
                ManagerDAL    m  = new ManagerDAL();
                logindelegate ld = new logindelegate(e.Login);
                Console.WriteLine("Username: "******"Password: "******"AdminManager Menu");
                            Console.WriteLine("1.Add New Employee");
                            Console.WriteLine("2.View All Employee");
                            Console.WriteLine("3.Add New LeaveType");
                            Console.WriteLine("4.View All LeaveTypes");
                            Console.WriteLine("5.Add New Portfoilo");
                            Console.WriteLine("6.Add New Project");
                            Console.WriteLine("7.View Leave Requests");
                            Console.WriteLine("8.Approval Status");
                            Console.WriteLine("9.Logout");
                            Console.WriteLine("Choice: ");
                            ch = Convert.ToInt32(Console.ReadLine());
                            switch (ch)
                            {
                            case 1:
                            {
                                int empid;
                                status = false;
                                Console.WriteLine("Search EmployeeID: ");
                                empid = Convert.ToInt32(Console.ReadLine());
                                foreach (var item in DataSource.edl)
                                {
                                    if (item.propEmployeeId == empid)
                                    {
                                        e.AddNewEmployee(item);
                                        status = true;
                                        break;
                                    }
                                }
                                if (status == false)
                                {
                                    Console.WriteLine("404. Employee Not Added :(");
                                }
                                break;
                            }

                            case 2:
                            {
                                foreach (var item in DataSource.edl)
                                {
                                    e.ViewEmployee(item);
                                }
                                break;
                            }

                            case 3:
                            {
                                int empid;
                                status = false;
                                Console.WriteLine("Search LeaveType: ");
                                empid = Convert.ToInt32(Console.ReadLine());
                                foreach (var item in DataSource.ltl)
                                {
                                    if (item.propLeaveTypeId3 == empid)
                                    {
                                        e.AddNewLeaveType(item);
                                        status = true;
                                        break;
                                    }
                                }
                                if (status == false)
                                {
                                    Console.WriteLine("404. LeaveType Not Added :(");
                                }
                                break;
                            }

                            case 4:
                            {
                                foreach (var item in DataSource.ltl)
                                {
                                    e.ViewLeaveType(item);
                                }
                                break;
                            }

                            case 5:
                            {
                                int empid;
                                status = false;
                                Console.WriteLine("Search PortfolioID: ");
                                empid = Convert.ToInt32(Console.ReadLine());
                                foreach (var item in DataSource.pl)
                                {
                                    if (item.propPortfolioId2 == empid)
                                    {
                                        e.AddPortfolio(item);
                                        status = true;
                                        break;
                                    }
                                }
                                if (status == false)
                                {
                                    Console.WriteLine("404. Portfolio Not Added :(");
                                }
                                break;
                            }

                            case 6:
                            {
                                int empid;
                                status = false;
                                Console.WriteLine("Search ProjectID: ");
                                empid = Convert.ToInt32(Console.ReadLine());
                                foreach (var item in DataSource.pl2)
                                {
                                    if (item.propProjectId2 == empid)
                                    {
                                        e.AddNewProject(item);
                                        status = true;
                                        break;
                                    }
                                }
                                if (status == false)
                                {
                                    Console.WriteLine("404. Project Not Added :(");
                                }
                                break;
                            }

                            case 7:
                            {
                                int leaveid;
                                status = false;
                                Console.WriteLine("Search LeaveID:");
                                leaveid = Convert.ToInt32(Console.ReadLine());
                                foreach (var it in DataSource.lal)
                                {
                                    if (it.propLeaveApplicationId == leaveid)
                                    {
                                        foreach (var i in it.propManagerId2)
                                        {
                                            m.ViewLeaveRequest(i);
                                        }
                                        status = true;
                                        break;
                                    }
                                }
                                if (!status)
                                {
                                    Console.WriteLine("404: Leave Not Found");
                                }
                                break;
                            }

                            case 8:
                            {
                                int leaveid;
                                status = false;
                                Console.WriteLine("Search LeaveID:");
                                leaveid = Convert.ToInt32(Console.ReadLine());
                                foreach (var it in DataSource.lal)
                                {
                                    if (it.propLeaveApplicationId == leaveid)
                                    {
                                        m.ApprovalStatus(leaveid, it.propleavestatus);
                                        status = true;
                                        break;
                                    }
                                }
                                if (!status)
                                {
                                    Console.WriteLine("404: Leave Not Found");
                                }
                                break;
                            }

                            case 9:
                            {
                                return;
                            }
                            }
                            Console.ReadKey();
                        }
                    }
                    else
                    {
                        Console.WriteLine("Role mismatch. Try Again :(");
                    }
                }
                else
                {
                    Console.WriteLine("Login Failed. Try Again :(");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            // throw new NotImplementedException();
        }
Exemplo n.º 2
0
        private static void Managerf()
        {
            try
            {
                string        u, p;
                int           eidf, ch;
                bool          status = false, loginn = false;
                ManagerDAL    m  = new ManagerDAL();
                logindelegate ld = new logindelegate(m.Login);
                Console.WriteLine("Username: "******"Password: "******"Manager Menu");
                            Console.WriteLine("1.View Leave Requests");
                            Console.WriteLine("2.Approval Status");
                            Console.WriteLine("3.Logout");
                            ch = Convert.ToInt32(Console.ReadLine());
                            switch (ch)
                            {
                            case 1:
                            {
                                int leaveid;
                                status = false;
                                Console.WriteLine("Search LeaveID:");
                                leaveid = Convert.ToInt32(Console.ReadLine());
                                foreach (var it in DataSource.lal)
                                {
                                    if (it.propLeaveApplicationId == leaveid)
                                    {
                                        foreach (var i in it.propManagerId2)
                                        {
                                            m.ViewLeaveRequest(i);
                                        }
                                        status = true;
                                        break;
                                    }
                                }
                                if (!status)
                                {
                                    Console.WriteLine("404: Leave Not Found");
                                }
                                break;
                            }

                            case 2:
                            {
                                int leaveid;
                                status = false;
                                Console.WriteLine("Search LeaveID:");
                                leaveid = Convert.ToInt32(Console.ReadLine());
                                foreach (var it in DataSource.lal)
                                {
                                    if (it.propLeaveApplicationId == leaveid)
                                    {
                                        m.ApprovalStatus(leaveid, it.propleavestatus);
                                        status = true;
                                        break;
                                    }
                                }
                                if (!status)
                                {
                                    Console.WriteLine("404: Leave Not Found");
                                }
                                break;
                            }

                            case 3:
                            {
                                return;
                            }
                            }
                            Console.ReadKey();
                        }
                    }
                    else
                    {
                        Console.WriteLine("Role mismatch. Try Again. :(");
                    }
                }
                else
                {
                    Console.WriteLine("Login Failed. Try Again. :(");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            //throw new NotImplementedException();
        }