Exemplo n.º 1
0
        public static void Login()
        {
            string userId = Employee.GetDocument().Document;

            if (EmployeeCtrl.SearchEmployeeDocument(userId))
            {
                Shop.LaunchShopMenu(userId);
            }
            else
            {
                Alert.ShowAlert("User doesn't exist on database.", ConsoleColor.DarkRed);
                Alert.Confirmation();
            }
        }
Exemplo n.º 2
0
        protected void LoadEmployeeDetailReport()
        {
            // Load Employee Data
            DataTable EmployeeList = EmployeeCtrl.GetEmployeeList();

            if (EmployeeCtrl.EmployeeID != 0)
            {
                DataView dv = new DataView(EmployeeList);
                dv.RowFilter = "userid = " + EmployeeCtrl.EmployeeID;
                rptEmployeeDetailReport.DataSource = dv;
            }
            else
            {
                rptEmployeeDetailReport.DataSource = EmployeeList;
            }

            rptEmployeeDetailReport.DataBind();
        }
Exemplo n.º 3
0
        public LogIn()
        {
            empCtrl = new EmployeeCtrl();

            InitializeComponent();
        }
Exemplo n.º 4
0
        public static void LaunchEmployeeMenu()
        {
            bool start = true;

            do
            {
                int option = (int)Options.Default;
                Banner.ShowBigBanner("Clients");
                try
                {
                    option = int.Parse(Console.ReadLine());
                }
                catch (Exception)
                {
                    Alert.ShowAlert("Please type a valid Option", ConsoleColor.Red);
                    Alert.Confirmation();
                }
                switch (option)
                {
                case (int)Options.Create:
                    try
                    {
                        Banner.ShowBanner("Create Client");
                        EmployeeCtrl.CreateEmployee(Employee.GetAllInfo());
                        Alert.Confirmation();
                    }
                    catch (ApplicationException error)
                    {
                        Alert.ShowAlert(error.Message, ConsoleColor.Red);
                        Alert.Confirmation();
                        App.InitializeApp();
                    }
                    break;

                case (int)Options.Search:
                    try
                    {
                        Banner.ShowBanner("Search Client");
                        EmployeeCtrl.ReadEmployee(Employee.GetDocument().Document);
                        Alert.Confirmation();
                    }
                    catch (ApplicationException error)
                    {
                        Alert.ShowAlert(error.Message, ConsoleColor.Red);
                        Alert.Confirmation();
                        App.InitializeApp();
                    }
                    break;

                case (int)Options.Catalog:
                    try
                    {
                        Banner.ShowBanner("Client Database");
                        EmployeeCtrl.ReadAllEmployees();
                        Alert.Confirmation();
                        break;
                    }
                    catch (ApplicationException error)
                    {
                        Alert.ShowAlert(error.Message, ConsoleColor.Red);
                        Alert.Confirmation();
                        App.InitializeApp();
                    }
                    break;

                case (int)Options.Update:
                    try
                    {
                        Banner.ShowBanner("Update Client");
                        EmployeeCtrl.UpdateEmployee(Employee.GetAllInfo());
                        Alert.Confirmation();
                    }
                    catch (ApplicationException error)
                    {
                        Alert.ShowAlert(error.Message, ConsoleColor.Red);
                        Alert.Confirmation();
                        App.InitializeApp();
                    }
                    break;

                case (int)Options.Delete:
                    try
                    {
                        Banner.ShowBanner("Delete Client");
                        EmployeeCtrl.DeleteEmployee(Employee.GetDocument().Document);
                        Alert.Confirmation();
                    }
                    catch (ApplicationException error)
                    {
                        Alert.ShowAlert(error.Message, ConsoleColor.Red);
                        Alert.Confirmation();
                        App.InitializeApp();
                    }
                    break;

                case (int)Options.Exit:
                    start = false;
                    break;
                }
            } while (start);
        }