private void showbutton_Click(object sender, EventArgs e)
        {
            oil obj = new oil();
            int c   = oil.q;

            textBox2.Text = c.ToString();
        }
예제 #2
0
 private void addbutton_Click(object sender, EventArgs e)
 {
     try
     {
         string com      = companytb.Text;
         string eos      = stockendselect.Text;
         string dop      = purchasedateselect.Text;
         string cost     = costtb.Text;
         string quantity = quantitytb.Text;
         string ty       = typeselect.Text;
         if (com == "" || com == "company" || cost == "Enter Cost Per Item" || quantity == "Enter quantity" || ty == "select type" || eos == "" || dop == "" || cost == "" || quantity == "" || ty == "")
         {
             label8.Visible = true;
         }
         else
         {
             MessageBox.Show(" UPDATED ");
             oil newoil = new oil();
             newoil.updateitem(cost, quantity, com, eos, dop, ty);
             companytb.Text          = null;
             stockendselect.Text     = null;
             purchasedateselect.Text = null;
             costtb.Text             = null;
             quantitytb.Text         = null;
             typeselect.Text         = null;
         }
     }
     catch
     {
         MessageBox.Show("cannot access database");
         Application.Exit();
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            oil    obj = new oil();
            string n   = textBox1.Text;
            string rt  = obj.viewquantity(n);

            items.Items.Add(rt);
            textBox1.Text = null;
        }
 private void viewitems_Load(object sender, EventArgs e)
 {
     try
     {
         oil          oilviewobj = new oil();
         DataGridView v          = itemsview;
         oilviewobj.viewitem(v);
     }
     catch
     {
         MessageBox.Show("ooff");
     }
 }
        private void deletebutton_Click(object sender, EventArgs e)
        {
            string tb = deletebox.Text;

            if (tb == "" || tb == "enter id")
            {
                label2.Visible = true;
            }
            else
            {
                oil o = new oil();
                o.deleteitem(tb);
                MessageBox.Show("successfull");
            }
        }
        private void addbutton1_Click(object sender, EventArgs e)
        {
            label2.Visible = false;
            string com = addcom.Text;
            string ty  = addty.Text;
            string i   = IDs.Text;

            if (i == "" || i == "Enter Id" || com == "" || com == "enter company" || ty == "" || ty == "Enter type")
            {
                label2.Visible = true;
            }
            else
            {
                oil oilobj = new oil();
                oilobj.additem(com, ty, i);
                MessageBox.Show("iem added successfully");
                com = addcom.Text = null;
                ty  = addty.Text = null;
            }
        }