Esempio n. 1
0
 private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.listView1.SelectedItems.Count > 0)
     {
         //if (MessageBox.Show("是否删除该设施类型?") == DialogResult.OK)
         if (MessageBox.Show("确定要删除该设施类型吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             if (this.listView1.SelectedItems[0].Tag is FacilityType)
             {
                 var             facilityType = this.listView1.SelectedItems[0].Tag as FacilityType;
                 var             serialnum    = facilityType.Serialnum;
                 List <Facility> facilityList = Facility.FindAllByFacilityTypeSerialnum(serialnum);
                 if (facilityList != null)
                 {
                     MessageBox.Show("该设备已经在使用,不能删除");
                     return;
                 }
                 FacilityType.Delete(facilityType);
                 this.InitFacilityTypeListView();
                 this.facilityTypeSerialnum = null;
             }
         }
     }
 }