/// <summary> /// 删除一条数据 /// </summary> public string Delete(int id, Model.manager manager) { Model.department model = GetModel(id); if (model == null) { return("数据不存在"); } if (hasEmployee(id)) { return("该机构下存在员工,不能删除"); } DataTable dt = GetList(id, ""); string idstr = id.ToString() + ","; foreach (DataRow dr in dt.Rows) { idstr += dr["de_id"] + ","; } idstr = idstr.TrimEnd(','); if (dal.Delete(idstr)) { if (model.de_type == 1) { Dictionary <string, string> dic = new Dictionary <string, string>(); DataTable dtt = dal.GetList(0, "de_type=1", "de_sort asc,de_id asc").Tables[0]; if (dtt.Rows.Count > 0) { foreach (DataRow dr in dtt.Rows) { dic.Add(dr["de_area"].ToString(), dr["de_subname"].ToString()); } CacheHelper.Remove(DTKeys.COMPANY_AREA); CacheHelper.Insert(DTKeys.COMPANY_AREA, dic, 10);//重新写入缓存 } } Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = id; logmodel.ol_title = "删除部门岗位"; logmodel.ol_content = "机构ID:" + id + "<br/>机构名称:" + model.de_name; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, manager.user_name, manager.real_name); return(""); } return("删除失败"); }
/// <summary> /// 删除一条数据 /// </summary> public bool Delete(int dep_id) { return(dal.Delete(dep_id)); }
/// <summary> /// 删除一条数据 /// </summary> public bool Delete(int id) { return(dal.Delete(id)); }