Ejemplo n.º 1
0
 private void toolStripButton4_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Record will be removed", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         int id = Convert.ToInt32(this.ProdListV.SelectedItems[0].Text);
         _supplier.Delete(id);
         MessageBox.Show("Record has been deleted.");
     }
     else
     {
         MessageBox.Show("Please select item first.");
     }
     loadInformation();
 }
Ejemplo n.º 2
0
    protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string message = "";

        try
        {
            Suppliers m_Suppliers = new Suppliers();
            m_Suppliers.SupplierId = System.Int32.Parse(m_grid.DataKeys[e.RowIndex].Value.ToString());
            m_Suppliers.Delete();
        }
        catch (Exception ex)
        {
            sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name);
        }
        ShowGrid();
    }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonSupDelete_Click(object sender, EventArgs e)
        {
            if (textBoxSupId.Text != "")
            {
                string strEmployee = textBoxSupName.Text;
                if (strEmployee == " ")
                {
                    strEmployee = textBoxSupId.Text;
                }

                Suppliers aSupplier = new Suppliers();
                if (!(aSupplier.IsDuplicateId(Convert.ToInt32(textBoxSupId.Text))))
                {
                    MessageBox.Show("Supplier Id Not Found!", "Wrong Id", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                byte Option = Convert.ToByte(MessageBox.Show("Confirm delete of Supplier\n " + strEmployee + " ?", "Delete Supplier", MessageBoxButtons.YesNo, MessageBoxIcon.Question));
                if (Option == 6)
                {
                    //===========================================================
                    // Delete dependencies
                    //===========================================================

                    /* In this case Books of this Supplier will not be deleted,
                     * Once the Inventory might have some books in stock yet.
                     * But it wil not be possible to update books quantity for
                     * Books that are supplied by the delete Supplier.
                     * =============================================================*/



                    //===========================================================
                    // Now delete Supplier
                    //===========================================================
                    aSupplier.Delete(Convert.ToInt32(textBoxSupId.Text));
                    MessageBox.Show("Supplier Deleted Succesfully!", "Supplier Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RefreshListViewSup();
                }
            }
            else
            {
                MessageBox.Show("Please enter a valid Supplier Id", "No Supplier Id", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 4
0
 protected void lbDelete_Click(object sender, EventArgs e)
 {
     try
     {
         Suppliers m_Suppliers = new Suppliers();
         foreach (GridViewRow m_Row in m_grid.Rows)
         {
             CheckBox chkAction = (CheckBox)m_Row.FindControl("chkAction");
             if (chkAction != null)
             {
                 if (chkAction.Checked)
                 {
                     m_Suppliers.SupplierId = System.Int32.Parse(m_grid.DataKeys[m_Row.RowIndex].Value.ToString());
                     m_Suppliers.Delete();
                 }
             }
         }
         ShowGrid();
     }
     catch (Exception ex)
     {
         sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name);
     }
 }
Ejemplo n.º 5
0
 public static void DeleteSupplier(int id)
 {
     Suppliers.Delete(id);
 }