예제 #1
0
        private void cmbItem_SelectedIndexChanged(object sender, EventArgs e)
        {
            dbClass db = new dbClass();

            System.Data.DataTable dt = db.dbSelect($"Select * FROM Items WHERE slot='{cmbSlot.Text}' AND owner='{cmbOwner.Text}' AND name='{cmbItem.Text}'");
            this.selectedItemPrice = dt.Rows[0][2].ToString();
            lblAvailable.Text      = dt.Rows[0][4].ToString();
        }
예제 #2
0
        private void getOwnerList()
        {
            dbClass db = new dbClass();

            System.Data.DataTable owners = db.dbSelect("SELECT id as 'uid', name as 'Owner Name', contact as 'Contact Number' FROM Owners");
            dataGridViewOwners.DataSource = owners;
            dataGridViewOwners.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridViewOwners.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridViewOwners.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
        }
예제 #3
0
        private void getItemList()
        {
            dbClass db = new dbClass();

            System.Data.DataTable items = db.dbSelect("SELECT id as 'uid', name as 'Item Name', price as 'Price', owner as 'Owner', quantity as 'Quantity', slot as 'Slot Number' FROM Items");
            dataGridViewItems.DataSource = items;
            dataGridViewItems.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridViewItems.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridViewItems.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridViewItems.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridViewItems.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridViewItems.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
        }
예제 #4
0
 private void getOwners()
 {
     try
     {
         dbClass db = new dbClass();
         System.Data.DataTable dt = db.dbSelect("Select * FROM Owners");
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             cmbItemOwner.Items.Add(dt.Rows[i]["name"]);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #5
0
 private void getSlot()
 {
     try
     {
         dbClass db = new dbClass();
         System.Data.DataTable dt = db.dbSelect($"Select * FROM Items");
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             cmbSlot.Items.Add(dt.Rows[i]["slot"]);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #6
0
 private void getItems()
 {
     cmbItem.Items.Clear();
     try
     {
         dbClass db = new dbClass();
         System.Data.DataTable dt = db.dbSelect($"Select * FROM Items WHERE slot='{cmbSlot.Text}' AND owner='{cmbOwner.Text}'");
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             cmbItem.Items.Add(dt.Rows[i]["name"]);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }