/// <summary>
 /// 删除记录
 /// </summary>
 private void DeleteLog_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult dialogResult = MessageBox.Show("是否删除该条记录", "删除确认", MessageBoxButtons.YesNoCancel); //设置弹出窗体的格式
         if (dialogResult == DialogResult.Yes)                                                           //如果选择确认按钮
         {
             string orderNum = InterviewIdTextBox.Text;                                                  //获取清单号
             int    id;
             if (!int.TryParse(orderNum, out id))                                                        //将其转换为数字失败
             {
                 MessageBox.Show("订单编号错误");
                 return;
             }
             if (interviewBll.DeleteInterviewList(id))//调用订单删除方法
             {
                 MessageBox.Show("删除成功");
             }
             else
             {
                 MessageBox.Show("删除失败");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     DataBind();//数据绑定
 }
Beispiel #2
0
        public void TestDeleteInterviewList()
        {
            int maxId = -1;

            foreach (InterviewList i in interviewBll.GetAllInterviewListArray())
            {
                if (i.Id > maxId)
                {
                    maxId = i.Id;
                }
            }
            if (maxId != -1)
            {
                Assert.AreEqual(true, interviewBll.DeleteInterviewList(maxId));
            }
            Assert.AreEqual(false, interviewBll.DeleteInterviewList(-1));
        }