Ejemplo n.º 1
0
        private void label7_Click(object sender, EventArgs e)
        {
            frmInventory inventory = new frmInventory();

            this.Hide();
            inventory.Show();
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmInventory inventory = new frmInventory();

            inventory.Show();
        }
        private void btnIn_Click(object sender, EventArgs e)
        {
            con.Open();
            string         query = "INSERT INTO tblIn_Out(Descr, Qty , Unit , DRNumber , Date , ProdType, TransType) VALUES('" + Global.name + "','" + txtQuantity.Text + "','" + Global.Unit + "','" + txtDRN.Text + "','" + dateNow.ToShortDateString() + "','" + Global.prodType + "','In' )";
            SqlDataAdapter sda   = new SqlDataAdapter(query, con);

            sda.SelectCommand.ExecuteNonQuery();
            con.Close();

            MessageBox.Show("Product record saved. Product quantity updated.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

            updateProductQuantity();

            frmInventory inventory = new frmInventory();

            this.Hide();
            inventory.Show();
        }
Ejemplo n.º 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (Global.adding == true && Global.editing == false)
            {
                DialogResult ask = MessageBox.Show("Add another product?", "Add", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (ask == DialogResult.Yes)
                {
                    if (Global.buttonSeedSelected == true || Global.buttonOthersSelected == true)
                    {
                        con.Open();
                        string         query = "INSERT INTO tblProducts(Descr, Qty , Unit , Supp , BaseP , SellP ,ProdType, BigItem, Location) VALUES('" + txtName.Text + "','" + txtQty.Text + "','" + txtUnit.Text + "','" + cmbSupp.Text + "','" + txtBP.Text + "','" + txtSP.Text + "','" + cmbProdType.Text + "','" + cmbBigItem.Text + "','" + txtLoc.Text + "')";
                        SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                        sda.SelectCommand.ExecuteNonQuery();
                        //MessageBox.Show("Product record saved.", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        frmInventory inventory = new frmInventory();
                        this.Hide();
                        inventory.Show();

                        con.Close();

                        getID();
                    }
                    else if (Global.buttonEquipmentSelected == true)
                    {
                        con.Open();
                        string         query = "INSERT INTO tblProducts(Descr, Qty , Unit , Supp , BaseP , SellP ,Model , PartNum , Location , SerialN , EngineN , BigItem, ProdType ) VALUES('" + txtName.Text + "','" + txtQty.Text + "','" + txtUnit.Text + "','" + cmbSupp.Text + "','" + txtBP.Text + "','" + txtSP.Text + "','" + txtModel.Text + "','" + txtPartNum.Text + "','" + txtLoc.Text + "','" + txtSN.Text + "','" + txtEN.Text + "','" + cmbBigItem.Text + "','" + cmbProdType.Text + "')";
                        SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                        sda.SelectCommand.ExecuteNonQuery();
                        //MessageBox.Show("Product record saved.", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        frmInventory inventory = new frmInventory();
                        this.Hide();
                        inventory.Show();

                        con.Close();
                    }
                }
            }


            else if (Global.editing == true && Global.adding == false)
            {
                DialogResult ask = MessageBox.Show("Edit product record?", "Edit", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (ask == DialogResult.Yes)
                {
                    if (Global.buttonSeedSelected == true || Global.buttonOthersSelected == true)
                    {
                        string query2 = "UPDATE tblProducts SET Descr='" + txtName.Text + "', Qty='" + txtQty.Text + "' , Unit='" + txtUnit.Text + "' , Supp='" + cmbSupp.Text + "' , BaseP='" + txtBP.Text + "' , SellP='" + txtSP.Text + "' , ProdType='" + cmbProdType.Text + "' WHERE ID = '" + Global.ID + "';";
                        con.Open();
                        SqlCommand     cmd2 = new SqlCommand(query2, con);
                        SqlDataReader  myreader2;
                        SqlDataAdapter sda = new SqlDataAdapter(query2, con);

                        try
                        {
                            myreader2 = cmd2.ExecuteReader();

                            while (myreader2.Read())
                            {
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        con.Close();
                        //MessageBox.Show("Record successfully updated.", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        frmInventory inventory = new frmInventory();
                        this.Hide();
                        inventory.Show();
                    }

                    else if (Global.buttonEquipmentSelected == true)
                    {
                        string query = "UPDATE tblProducts SET Descr='" + txtName.Text + "', Qty='" + txtQty.Text + "' , Unit='" + txtUnit.Text + "' , Supp='" + cmbSupp.Text + "' , BaseP='" + txtBP.Text + "' , SellP='" + txtSP.Text + "' , ProdType='" + cmbProdType.Text + "' , Model='" + txtModel.Text + "' , PartNum='" + txtPartNum.Text + "', Location='" + txtLoc.Text + "' , SerialN='" + txtSN.Text + "' , EngineN='" + txtEN.Text + "' , BigItem='" + cmbBigItem.Text + "' WHERE ID = '" + Global.ID + "';";
                        con.Open();
                        SqlCommand     cmd = new SqlCommand(query, con);
                        SqlDataReader  myreader;
                        SqlDataAdapter sda = new SqlDataAdapter(query, con);

                        try
                        {
                            myreader = cmd.ExecuteReader();

                            while (myreader.Read())
                            {
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        con.Close();
                        //MessageBox.Show("Record successfully updated.","Update",MessageBoxButtons.OK,MessageBoxIcon.Information);
                        frmInventory inventory = new frmInventory();
                        this.Hide();
                        inventory.Show();
                    }
                }
            }
        }