예제 #1
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            if (cmbCompanyName.SelectedItem != null && cmbCategoryName.SelectedItem != null && cmbProductName.SelectedItem != null)
            {
                Connector connection = new MYSQLDatabaseConnection();

                DatabaseColumn dataset = new DatabaseColumn();
                dataset.product_id     = connection.SearchProductList(tempProductList, cmbProductName.SelectedIndex.ToString()).product_id;
                dataset.stock_date     = txtStockDate.Text.ToString();
                dataset.invoice_number = txtInvoiceNumber.Text.ToString();
                dataset.start_quantity = txtQuantity.Text.ToString();
                dataset.exp_date       = txtExpDate.Text.ToString();
                dataset.get_price      = txtGetPrice.Text.ToString();
                dataset.barcode        = barcode;
                connection.SetData(dataset);

                connection.establish();
                if (connection.ChangeStockDetails())
                {
                    List <DatabaseColumn> dgvList = new List <DatabaseColumn>();
                    dgvList.Add(dataset);
                    CombineDataGridView combindDataGrid = new CombineDataGridView();
                    combindDataGrid.SetDataGridViewList(dgvList, dgv);
                    MessageBox.Show("changed");
                }
                else
                {
                    MessageBox.Show("can't changed");
                }
            }
            else
            {
                MessageBox.Show("fill all requred data");
            }
        }