Exemple #1
0
        // Andy Gao
        private void supplierNameComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (loaded)
            {
                try
                {
                    int supplierId = Convert.ToInt32(supplierNameComboBox.SelectedValue);

                    supplierdetail = SupplierDetailsDB.GetSupplierDetails(supplierId);
                    DisplaySupplierDetails();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }

                try
                {
                    // Receive supplierID from combobox selection
                    string supplierId = supplierNameComboBox.Text;

                    // Add details to supplierdetail
                    supplierdetail = SupplierDetailsDB.GetSupplierDetailInfo(supplierId);

                    // Display in corresponding texts
                    DisplaySupplierDetails();
                    supplierIDTextBox.Text = supplierNameComboBox.SelectedValue.ToString();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Exemple #2
0
        private void SupplierForm_Load(object sender, EventArgs e)
        {
            int supplierId = Convert.ToInt32(supplierNameComboBox.SelectedValue);

            supplierdetail = SupplierDetailsDB.GetSupplierDetails(supplierId);
            LoadSupplierComboBox();
            supplierNameTextBox.Visible = false;
            saveModifyButton.Visible    = false;
            cancelButton.Visible        = false;
        }