protected void DepDisplayGrid_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         DepartmentBLL depManager  = new DepartmentBLL();
         Label         ID          = (Label)DepDisplayGrid.Rows[e.RowIndex].FindControl("lblDep_ID");
         int           selectedId  = int.Parse(ID.Text);
         Department    depToDelete = new Department();//= empid.Text;
         depToDelete.DepartmentID = selectedId;
         depManager.Delete(depToDelete, connection);
     }
     catch (Exception exp) { }
     finally
     {
         DepDisplayGrid.EditIndex = -1;
         BindGrid(false);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 用户单击“删除”按钮时的事件处理方法。
 /// </summary>
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     DepartmentBLL.Delete(department.Id.Value); // 调用“业务逻辑层”的方法,删除关联对象并更新至数据库。
     FormSysMessage.ShowSuccessMsg("“部门信息”删除成功,单击“确定”按钮返回信息列表。");
     FormMain.LoadNewControl(Default.Instance); // 删除完成后,载入该模块的信息列表界面至主窗体显示。
 }