Exemplo n.º 1
0
 //删除选中记录集
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     FineUI.Button btn = (FineUI.Button)sender;
     #region 主表删除事件
     if (btn.ID == "btnDelete")
     {
         if (gridRoutingSub.RecordCount > 0)
         {
             Alert.ShowInTop("在删除该项前,请删除所有子项", "错误", MessageBoxIcon.Error);
             return;
         }
         else
         {
             BLL.tb_JC_Routing bllRouting = new BLL.tb_JC_Routing();
             string            id         = gridRouting.DataKeys[gridRouting.SelectedRowIndex][0].ToString();
             bool result = bllRouting.Delete(id);
             if (result)
             {
                 Alert.ShowInTop("删除成功", "信息", MessageBoxIcon.Information);
                 BindGrid();
             }
             else
             {
                 Alert.ShowInTop("删除失败", "错误", MessageBoxIcon.Error);
             }
             return;
         }
     }
     #endregion
     #region  除子表记录
     if (btn.ID == "btnDeleteSub")
     {
         BLL.tb_JC_RoutingSub bllRoutingSub = new BLL.tb_JC_RoutingSub();
         string id     = gridRoutingSub.DataKeys[gridRoutingSub.SelectedRowIndex][0].ToString();
         bool   result = bllRoutingSub.Delete(id);
         if (result)
         {
             Alert.ShowInTop("删除成功", "信息", MessageBoxIcon.Information);
             BindGridSub(gridRouting.DataKeys[gridRouting.SelectedRowIndex][0].ToString());
         }
         else
         {
             Alert.ShowInTop("删除失败", "错误", MessageBoxIcon.Error);
         }
         return;
     }
     #endregion
 }