示例#1
0
        private void butDelete_Click(object sender, System.EventArgs e)
        {
            //Before deleting the actual type, we would need to check special types.

            /*if(RecallCur.IsNew){
             *      DialogResult=DialogResult.Cancel;
             *      return;
             * }
             * if(!MsgBox.Show(this,true,"Delete this RecallType?")) {
             *      return;
             * }
             * try{
             *      Pharmacies.DeleteObject(PharmCur.PharmacyNum);
             *      DialogResult=DialogResult.OK;
             * }
             * catch(Exception ex){
             *      MessageBox.Show(ex.Message);
             * }*/
            if (!Security.IsAuthorized(Permissions.SecurityAdmin))
            {
                return;
            }
            if (listTriggers.Items.Count > 0)
            {
                MsgBox.Show(this, "All triggers must first be deleted.");
                return;
            }
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Are you absolutely sure you want to delete all recalls of this type?"))
            {
                return;
            }
            Recalls.DeleteAllOfType(RecallTypeCur.RecallTypeNum);
            CountForType = Recalls.GetCountForType(RecallTypeCur.RecallTypeNum);
            MsgBox.Show(this, "Done.");
        }