예제 #1
0
        void loadGlobals()
        {
            UserDAO     userDAO     = new MySqlUserDAO();
            CustomerDAO customerDAO = new MySqlCustomerDAO();
            EquipoDAO   equipoDAO   = new MySqlEquipoDAO();
            SucursalDAO sucursalDAO = new MySqlSUcursalDAO();

            Utils.usersGlobal     = userDAO.getUsersList();
            Utils.customersGlobal = customerDAO.getCustomerList();
            Utils.equiposGlobal   = equipoDAO.getEquiposList();
            Utils.SucursalsGlobal = sucursalDAO.getSucursalList();
            Utils.thisSucursal    = Utils.SucursalsGlobal[0];
            Utils.currentCustomer = null;
        }
        public void AddCustomer(Customer customer)
        {
            CustomerDAO customerDao = new MySqlCustomerDAO();
            bool        isSaved     = customerDao.saveCustomer(customer);

            if (isSaved)
            {
                form.emptyTextBoxes();
                form.displayMessage("User saved succesfully!");
            }
            else
            {
                form.displayMessage("User could not be saved :(");
            }
        }
        public void EditCustomer(Customer customer)
        {
            CustomerDAO customerDao = new MySqlCustomerDAO();
            bool        success     = customerDao.editCustomer(customer);

            if (success)
            {
                form.displayMessage("User saved successfully");
                form.close();
            }
            else
            {
                form.displayMessage("Something happend, try again later");
            }
        }
예제 #4
0
        public static void UpdateCustomers()
        {
            CustomerDAO customerDAO = new MySqlCustomerDAO();

            customersGlobal = customerDAO.getCustomerList();
        }