예제 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure you want to delete this refill?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (confirmResult == DialogResult.Yes)
            {
                try
                {
                    //Send it throug the datatier
                    PharmacyDataTier bPharm = new PharmacyDataTier();
                    DataSet          ds1    = new DataSet();
                    ds1 = bPharm.DeleteRefill(myFulfillmentID);
                    MessageBox.Show("Refill deleted successfully", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                catch (Exception ex)
                {
                    string myException = ex.ToString();
                    MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
            }
        }
예제 #2
0
        private void btnDeleteRefill_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure you want to delete this refill?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (confirmResult == DialogResult.Yes)
            {
                try
                {
                    if (dgvRefills.Rows.Count > 0)
                    {
                        DataGridViewRow row = dgvRefills.SelectedRows[0];
                        myFulfillmentID = row.Cells[0].Value.ToString();
                        //Send it throug the datatier
                        PharmacyDataTier bPharm = new PharmacyDataTier();
                        DataSet          ds1    = new DataSet();
                        ds1 = bPharm.DeleteRefill(myFulfillmentID);
                        MessageBox.Show("Refill deleted successfully", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        UpdateRefillDatagrid();
                    }
                    else
                    {
                        MessageBox.Show("Please select a row to delete", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch (Exception ex)
                {
                    string myException = ex.ToString();
                    MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
            }
        }