//On combo box selected index changed event populate data into list box
        private void cmbProducts_SelectedIndexChanged(object sender, EventArgs e)
        {
            PackageDB supplierObj = new PackageDB();
            int       getPkgId    = 0;

            if (pkgDataGrid.SelectedCells.Count > 0)
            {
                int selectedrowindex = pkgDataGrid.SelectedCells[0].RowIndex;

                DataGridViewRow selectedRow = pkgDataGrid.Rows[selectedrowindex];

                getPkgId = Convert.ToInt32(selectedRow.Cells["PackageId"].Value);
                Package_AddProduct_DB getSupIdobj = new Package_AddProduct_DB();
                getSupIdobj.GetSupplierId(getPkgId);
                pkgProductGrid.DataSource = getSupIdobj.getPackageProduct();
            }
            if (supplierObj.FetchSuppliers(Convert.ToString(cmbProducts.Text), getPkgId))
            {
                lstSuppliers.Items.Clear();
                while (supplierObj.reader.Read())
                {
                    lstSuppliers.Items.Add(supplierObj.reader.GetValue(0));
                }
                supplierObj.reader.Close();
            }
        }
        //Refresh product grid view on update
        private void Refresh_Products_Onupdate()
        {
            int getPkgId;

            if (pkgDataGrid.SelectedCells.Count > 0)
            {
                int selectedrowindex = pkgDataGrid.SelectedCells[0].RowIndex;

                DataGridViewRow selectedRow = pkgDataGrid.Rows[selectedrowindex];

                getPkgId = Convert.ToInt32(selectedRow.Cells["PackageId"].Value);
                Package_AddProduct_DB getSupidobj = new Package_AddProduct_DB();
                getSupidobj.GetSupplierId(getPkgId);
                pkgProductGrid.DataSource = getSupidobj.getPackageProduct();
            }
        }
        //On gridview click refresh the data
        private void pkgDataGrid_Click(object sender, EventArgs e)
        {
            int getPkgId = 0;

            if (pkgDataGrid.SelectedCells.Count > 0)
            {
                int selectedrowindex = pkgDataGrid.SelectedCells[0].RowIndex;

                DataGridViewRow selectedRow = pkgDataGrid.Rows[selectedrowindex];

                getPkgId = Convert.ToInt32(selectedRow.Cells["PackageId"].Value);
                Package_AddProduct_DB getSupIdobj = new Package_AddProduct_DB();
                getSupIdobj.GetSupplierId(getPkgId);
                pkgProductGrid.DataSource = getSupIdobj.getPackageProduct();
            }
        }