Exemplo n.º 1
0
        private void btnDelete_Click(object sender, EventArgs e)//button for delete
        {
            OperationSign = "Delete";

            cklstProductSupplier.Visible = false;

            btnDelete.Enabled         = false;
            currentDeleteProductId    = Convert.ToInt32(lstProducts.SelectedValue);  //get delete target productID
            currentDeleteSupplierId   = Convert.ToInt32(lstSuppliers.SelectedValue); //get delete target supplierID
            currentDeleteProductName  = lstProducts.Text;
            currentDeleteSupplierName = lstSuppliers.Text;

            currentDeleteProductSupplierId = ProductSupplierDB.getProductSupplierId(currentDeleteProductId, currentDeleteSupplierId); //get productsupplierId in PS TABLE
            if (ProductSupplierDB.referencedInPackages(currentDeleteProductSupplierId))                                               //chech delete target is referenced in Package table or no
            {
                MessageBox.Show("The product:" + currentDeleteProductName + " with supplier of " + currentDeleteSupplierName + " has been referenced in Package Table,Please go to Package!");
                panel2.Visible  = false;
                panel1.Visible  = true;
                btnSave.Enabled = false;
                lblSave.Enabled = false;
                lblSave.Visible = false;
            }
            else//selected row is not referenced in PAckage Table
            {
                panel2.Visible  = true;
                panel1.Visible  = false;
                btnSave.Enabled = true;
                lblSave.Enabled = true;
                lblSave.Visible = true;
                currentPS       = OperationPS.getCurrentPS(currentDeleteProductId, currentDeleteSupplierId, OperationSign);

                lblSave.Text = "You are preparing to delete product:" + currentDeleteProductName + " with supplier:" + currentDeleteSupplierName;
                Display();
            }
        }
Exemplo n.º 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //int currentDeletePSid;
            OperationSign = "Delete";
            //

            cklstProductSupplier.Visible = false;
            //

            btnDelete.Enabled = false;
            //
            currentDeleteProductId    = Convert.ToInt32(lstProducts.SelectedValue);
            currentDeleteSupplierId   = Convert.ToInt32(lstSuppliers.SelectedValue);
            currentDeleteProductName  = lstProducts.Text;
            currentDeleteSupplierName = lstSuppliers.Text;

            currentDeleteProductSupplierId = ProductSupplierDB.getProductSupplierId(currentDeleteProductId, currentDeleteSupplierId);//get productsupplierId in PS TABLE
            if (ProductSupplierDB.referencedInPackages(currentDeleteProductSupplierId))
            {
                MessageBox.Show("Your selection product:" + currentDeleteProductName + " with supplier of " + currentDeleteSupplierName + " has been referenced in Package Table,Please go to Package!");
                panel2.Visible  = false;
                panel1.Visible  = true;
                btnSave.Enabled = false;
                lblSave.Enabled = false;
                lblSave.Visible = false;
            }
            else
            {
                panel2.Visible  = true;
                panel1.Visible  = false;
                btnSave.Enabled = true;
                lblSave.Enabled = true;
                lblSave.Visible = true;
                currentPS       = OperationPS.getCurrentPS(currentDeleteProductId, currentDeleteSupplierId, OperationSign);

                lblSave.Text = "You are preparing to delete product:" + currentDeleteProductName + " with supplier:" + currentDeleteSupplierName;
                Display();
            }
        }