/// <summary> /// 删除 /// </summary> /// <param name="strLogID"></param> protected void DeleteData(string strLogID) { EmployeeDetailBLL employeeDetailBLL = new EmployeeDetailBLL(); if (OrgList.SelectedIndex == 0) { if (employeeDetailBLL.GetEmployeeByWhere("Education_Level_ID=" + strLogID) > 0) { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } EducationLevelBLL objBll = new EducationLevelBLL(); string educationName = objBll.GetEducationLevelByEducationLevelID(Convert.ToInt32(strLogID)).EducationLevelName; objBll.DeleteEducationLevel(Convert.ToInt32(strLogID), ""); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[0].Text + ":" + educationName); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 1) { if (employeeDetailBLL.GetEmployeeByWhere("POLITICAL_STATUS_ID=" + strLogID) > 0) { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } PoliticalStatusBLL objBll = new PoliticalStatusBLL(); string politicalName = objBll.GetPoliticalStatusByPoliticalStatusID(Convert.ToInt32(strLogID)).PoliticalStatusName; objBll.DeletePoliticalStatus(Convert.ToInt32(strLogID)); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[1].Text + ":" + politicalName); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 2) { if (employeeDetailBLL.GetEmployeeByWhere("workgroupleader_type_id=" + strLogID) > 0) { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } WorkGroupLeaderLevelBLL objBll = new WorkGroupLeaderLevelBLL(); string wrokgroupName = objBll.GetWorkGroupLeaderLevelByWorkGroupLeaderLevelID(Convert.ToInt32(strLogID)).LevelName; objBll.DeleteWorkGroupLeaderLevel(Convert.ToInt32(strLogID)); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[2].Text + ":" + wrokgroupName); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 3) { if (employeeDetailBLL.GetEmployeeByWhere("TECHNICIAN_TYPE_ID=" + strLogID) > 0) { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } TechnicianTypeBLL objBll = new TechnicianTypeBLL(); string technicianName = objBll.GetTechnicianTypeByTechnicianTypeID(Convert.ToInt32(strLogID)).TypeName; objBll.DeleteTechnicianType(Convert.ToInt32(strLogID), ""); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[3].Text + ":" + technicianName); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 4) { if (employeeDetailBLL.GetEmployeeByWhere("TECHNICAL_TITLE_ID=" + strLogID) > 0) { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } TechnicianTitleTypeBLL objBll = new TechnicianTitleTypeBLL(); string technicianTitleName = objBll.GetTechnicianTitleTypeByTechnicianTitleTypeID(Convert.ToInt32(strLogID)).TypeName; objBll.DeleteTechnicianTitleType(Convert.ToInt32(strLogID)); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[4].Text + ":" + technicianTitleName); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 5) { if (employeeDetailBLL.GetEmployeeByWhere("education_employee_type_id=" + strLogID) > 0) { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } EducationEmployeeTypeBLL objBll = new EducationEmployeeTypeBLL(); string technicianTitleName = objBll.GetEducationEmployeeTypeByEducationEmployeeTypeID(Convert.ToInt32(strLogID)).TypeName; objBll.DeleteEducationEmployeeType(Convert.ToInt32(strLogID)); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[5].Text + ":" + technicianTitleName); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 6) { if (employeeDetailBLL.GetEmployeeByWhere("committee_head_ship_id=" + strLogID) > 0) { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } CommitteeHeadShipBLL objBll = new CommitteeHeadShipBLL(); string ShipName = objBll.GetCommitteeHeadShipByCommitteeHeadShipID(Convert.ToInt32(strLogID)).CommitteeHeadShipName; objBll.DeleteCommitteeHeadShip(Convert.ToInt32(strLogID)); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[6].Text + ":" + ShipName); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 7) { RandomExamModularTypeBLL objBll = new RandomExamModularTypeBLL(); if (objBll.GetRandomExam(Convert.ToInt32(strLogID)) > 0) { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } string TypeName = objBll.GetRandomExamModularTypeByTypeID(Convert.ToInt32(strLogID)).RandomExamModularTypeName; objBll.DeleteCommitteeHeadShip(Convert.ToInt32(strLogID)); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[7].Text + ":" + TypeName); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 8) { OracleAccess oracle = new OracleAccess(); DataTable dt = oracle.RunSqlDataSet( string.Format(" select * from zj_train_plan where train_plan_type_id={0}", Convert.ToInt32(strLogID))).Tables[0]; if (dt.Rows.Count > 0) { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } string TypeName = oracle.RunSqlDataSet( string.Format("select trainplan_type_name from zj_trainplan_type where trainplan_type_id={0}", Convert.ToInt32(strLogID))).Tables[0].Rows[0]["trainplan_type_name"].ToString(); oracle.ExecuteNonQuery(string.Format("delete from zj_trainplan_type where trainplan_type_id={0}", Convert.ToInt32(strLogID))); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[8].Text + ":" + TypeName); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 9) { OracleAccess access = new OracleAccess(); DataTable dt = access.RunSqlDataSet("select count(1) from employee where safe_level_id=" + strLogID).Tables[0]; if (Convert.ToInt32(dt.Rows[0][0]) > 0) { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } string sql = "select safe_level_name from zj_safe_level where safe_level_id=" + strLogID; DataTable dt1 = access.RunSqlDataSet(sql).Tables[0]; try { access.ExecuteNonQuery(@" update zj_safe_level set order_index=order_index-1 where order_index> (select order_index from zj_safe_level where safe_level_id=" + strLogID + ")"); access.ExecuteNonQuery("delete from zj_safe_level where safe_level_id=" + strLogID); } catch { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[9].Text + ":" + dt1.Rows[0][0]); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 10) { OracleAccess access = new OracleAccess(); string sql = "select certificate_name from zj_certificate where certificate_id=" + strLogID; DataTable dt1 = access.RunSqlDataSet(sql).Tables[0]; try { access.ExecuteNonQuery( @" update zj_certificate set order_index=order_index-1 where order_index> (select order_index from zj_certificate where certificate_id=" + strLogID + ")"); access.ExecuteNonQuery("delete from zj_certificate where certificate_id=" + strLogID); } catch { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[10].Text + ":" + dt1.Rows[0][0]); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 11) { OracleAccess access = new OracleAccess(); string sql = "select certificate_level_name from zj_certificate_level where certificate_level_id=" + strLogID; DataTable dt1 = access.RunSqlDataSet(sql).Tables[0]; try { access.ExecuteNonQuery( @" update zj_certificate_level set order_index=order_index-1 where order_index> (select order_index from zj_certificate_level where certificate_level_id=" + strLogID + ")"); access.ExecuteNonQuery("delete from zj_certificate_level where certificate_level_id=" + strLogID); } catch { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[11].Text + ":" + dt1.Rows[0][0]); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 12) { OracleAccess access = new OracleAccess(); string sql = "select certificate_unit_name from zj_certificate_unit where certificate_unit_id=" + strLogID; DataTable dt1 = access.RunSqlDataSet(sql).Tables[0]; try { access.ExecuteNonQuery( @" update zj_certificate_unit set order_index=order_index-1 where order_index> (select order_index from zj_certificate_unit where certificate_unit_id=" + strLogID + ")"); access.ExecuteNonQuery("delete from zj_certificate_unit where certificate_unit_id=" + strLogID); } catch { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[12].Text + ":" + dt1.Rows[0][0]); BindGrid(OrgList.SelectedIndex); } if (OrgList.SelectedIndex == 13) { OracleAccess access = new OracleAccess(); string sql = "select train_unit_name from zj_train_unit where train_unit_id=" + strLogID; DataTable dt1 = access.RunSqlDataSet(sql).Tables[0]; try { access.ExecuteNonQuery( @" update zj_train_unit set order_index=order_index-1 where order_index> (select order_index from zj_train_unit where train_unit_id=" + strLogID + ")"); access.ExecuteNonQuery("delete from zj_train_unit where train_unit_id=" + strLogID); } catch { hfMessage.Value = "该数据字典已被引用,不能删除!"; BindGrid(OrgList.SelectedIndex); return; } SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("删除" + OrgList.Items[13].Text + ":" + dt1.Rows[0][0]); BindGrid(OrgList.SelectedIndex); } }