Ejemplo n.º 1
0
        private void login()
        {
            Database_Class database = new Database_Class();
            string         password = database.getLogins(UsernameField.Text);

            String entered_name = UsernameField.Text;
            String entered_pass = PasswordField.Text;

            if ((entered_name == "") || (entered_pass == ""))
            {
                IncorrectCredentials.Show();
            }
            else if (password.Equals(entered_pass))
            {
                //You may login
                //Hide the incorrect credentials message box
                IncorrectCredentials.Hide();
                //Create and show the main menu when login is successful
                Main_Menu _mainMenu = new Main_Menu();
                Hide();
                _mainMenu.Show();
            }
            else
            {
                //You may not login. Incorrect Credentials
                IncorrectCredentials.Show();
            }
        }
Ejemplo n.º 2
0
 //**********************************************************************************************************************************************
 private void ElectronicToolsGrid_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         Database_Class database = new Database_Class();
         database.editItems(dataGridView());
     }
 }
        //****************************************************************************************************************

        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (thisGridView().SelectedCells.Count > 0)
            {
                Display_Manager _display_manager = new Display_Manager();

                string _verification_message = _display_manager.Delete_Verification_Message(thisGridView());
                int    Item_ID = _display_manager.get_Item_ID(thisGridView());

                Database_Class database_access = new Database_Class();
                database_access.deleteItem(Item_ID, _verification_message);
                refresh_dataGridView();
            }
        }
        //****************************************************************************************************************

        private void AddNewButton_Click(object sender, EventArgs e)
        {
            Display_Manager _display_manager = new Display_Manager();

            string[] _items   = { txtName.Text, txtDescription.Text, txtManufacturer.Text, CATEGORY, txtNumber.Text, CB_Available.Text, txtCondition.Text, txtLocation.Text };
            string[] _entries = _display_manager.Validate_Entries(_items);

            if (_entries != null)
            {
                //Load entries into the database
                Database_Class database_access = new Database_Class();

                database_access.addItem(_items);
                refresh_dataGridView(); // Refresh the viewed data after you finish adding an item
            }
        }
Ejemplo n.º 5
0
        //*******************************************************************************************************************************************************************************

        public void Refresh(DataGridView grid, string category, string filter_string)
        {
            Database_Class database_access = new Database_Class();
            DataSet        dataset         = new DataSet();

            database_access.SelectItems(ref dataset, category, filter_string);

            //Chosing the data to be displayed in the Grid View on the Screen
            grid.DataSource = dataset.Tables[0];

            //Making sure that the data grid view uses up all the space avaibale on the screen
            grid.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            grid.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            grid.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            grid.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            grid.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            grid.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            grid.Columns[6].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            grid.Columns[7].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            grid.Columns[8].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;

            //Hide the Item_ID and the Category from the grid view
            grid.Columns["Item_ID"].Visible  = false;
            grid.Columns["Category"].Visible = false;

            // Control The Edit Previlleges
            // Columns 6 and 9 are: Item Availability and Borrower
            // These columns need to ne editable
            grid.ReadOnly            = false;
            grid.Columns[1].ReadOnly = true;
            grid.Columns[2].ReadOnly = true;
            grid.Columns[3].ReadOnly = true;
            grid.Columns[4].ReadOnly = true;
            grid.Columns[5].ReadOnly = true;
            grid.Columns[7].ReadOnly = true;
            grid.Columns[8].ReadOnly = true;
            grid.EditMode            = DataGridViewEditMode.EditOnEnter;
        }
Ejemplo n.º 6
0
        //**********************************************************************************************************************************************

        private void btnBorrowed_Click(object sender, EventArgs e)
        {
            Database_Class database = new Database_Class();

            database.editItems(dataGridView());
        }