Beispiel #1
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you Sure update product details?", "Veryfy", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                Connector connector = new MYSQLDatabaseConnection();

                /*catch update details into databaseColumn*/
                DatabaseColumn updateDatabaseColumn = new DatabaseColumn();
                updateDatabaseColumn.company_id             = connector.SearchCompanyList(TempCompanyList, cmbCompanyName.SelectedItem.ToString()).company_id;
                updateDatabaseColumn.category_id            = connector.SearchCategoryList(TempCategoryList, cmbCategoryName.SelectedItem.ToString()).category_id;
                updateDatabaseColumn.product_id             = txtProductId.Text.ToString();
                updateDatabaseColumn.product_name           = txtProductName.Text;
                updateDatabaseColumn.sell_price             = txtSellPrice.Text;
                updateDatabaseColumn.product_discount_price = txtDiscount.Text;
                updateDatabaseColumn.minimum_quantity       = txtMinimumQuantity.Text;

                List <DatabaseColumn> TempListForDGV = new List <DatabaseColumn>();
                TempListForDGV.Add(updateDatabaseColumn);


                connector.establish();
                connector.SetData(updateDatabaseColumn);

                if (connector.ChangeProductDetails() == true)
                {
                    CombineDataGridView combineDataGridView = new CombineDataGridView();
                    combineDataGridView.SetDataGridViewList(TempListForDGV, mDgv);
                    MessageBox.Show("Update compliete");
                    txtDiscount.Clear();
                    txtMinimumQuantity.Clear();
                    txtProductId.Clear();
                    txtProductName.Clear();
                    txtSellPrice.Clear();
                }
                else
                {
                    MessageBox.Show("Try again");
                }
            }
        }