protected void ButtonOK_Click(object sender, EventArgs e) { bool done = false; StringBuilder stringBuilder = new StringBuilder(); DetectorTypeBusiness business = new DetectorTypeBusiness(); if (this.CheckBoxListDetectorTypes.Items != null) { List<DetectorType> detectorTypes = new List<DetectorType>(); for (int i = 0; i < this.CheckBoxListDetectorTypes.Items.Count; i++) { if (this.CheckBoxListDetectorTypes.Items[i].Selected) { DetectorType detectorType = new DetectorType(); detectorType.Guid = this.CheckBoxListDetectorTypes.Items[i].Value; detectorTypes.Add(detectorType); } } if ((detectorTypes != null) && (detectorTypes.Count > 0)) { int success = 0; int fail = 0; for (int i = 0; i < detectorTypes.Count; i++) { try { this.UploadFileDelete(this.MapPath(detectorTypes[i].NormalHref)); this.UploadFileDelete(this.MapPath(detectorTypes[i].ErrorHref)); } finally { } done = business.Delete(detectorTypes[i]); if (done) { success++; } else { fail++; } } stringBuilder.Append(string.Format("删除{0}个探头类型成功!", success)); stringBuilder.Append(string.Format("删除{0}个探头类型失败!", fail)); } } this.LabelMessage.Text = stringBuilder.ToString(); this.InitializeBind(); }