public int DelDictuserandlabdeptByUserID(string strId) { int nflag = 0; try { var arrayId = strId.Split(','); //临时存储待删除对象,备写日志用 List <Dictuserandlabdept> dictLibraryList = new List <Dictuserandlabdept>(); foreach (string strid in arrayId) { dictLibraryList.Add(GetDictuserandlabdeptById(Convert.ToDouble(strid))); } nflag = this.delete("Dict.DeleteDictuserandlabdeptByUserId", strId); foreach (Dictuserandlabdept item in dictLibraryList) { Dictlabdept dictlabdep = new Dictlabdept(); dictlabdep.Dictlabdeptid = item.Dictlabdeptid; dictlabdep = new DictlabdeptService().GetDictlabdeptInfo(dictlabdep); AddMaintenanceLog("Dictuserandlabdept", item.Dictuserandlabdeptid, null, "删除", dictlabdep.Labdeptname, item.Createdate.ToString(), modulename); } } catch (Exception ex) { throw new Exception(ex.Message); } return(nflag); }
///<summary> ///新增编辑后保存 ///</summary> ///<param name="library"></param> /// <returns></returns> public bool SaveDictuserandlabdept(Dictuserandlabdept library) { int nflag = 0; //新增 if (library.Dictuserandlabdeptid == 0 || library.Dictuserandlabdeptid == null) { try { library.Dictuserandlabdeptid = getSeqID("SEQ_DICTUSERANDLABDEPT"); insert("Dict.InsertDictuserandlabdept", library); nflag = 1; List <LogInfo> logLst = getLogInfo <Dictuserandlabdept>(new Dictuserandlabdept(), library); Dictlabdept dictlabdep = new Dictlabdept(); dictlabdep.Dictlabdeptid = library.Dictlabdeptid; dictlabdep = new DictlabdeptService().GetDictlabdeptInfo(dictlabdep); AddMaintenanceLog("Dictuserandlabdept", int.Parse(library.Dictuserandlabdeptid.ToString()), logLst, "新增", dictlabdep.Labdeptname, library.Createdate.ToString(), modulename); } catch (Exception ex) { nflag = 0; throw new Exception(ex.Message); } } else//保存 { try { Dictuserandlabdept dictcustomer = GetDictuserandlabdeptInfo(library); nflag = update("Dict.UpdateDictuserandlabdept", library); List <LogInfo> logLst = getLogInfo <Dictuserandlabdept>(dictcustomer, library); Dictlabdept dictlabdep = new Dictlabdept(); dictlabdep.Dictlabdeptid = library.Dictlabdeptid; dictlabdep = new DictlabdeptService().GetDictlabdeptInfo(dictlabdep); AddMaintenanceLog("Dictuserandlabdept", int.Parse(library.Dictuserandlabdeptid.ToString()), logLst, "修改", dictlabdep.Labdeptname, library.Createdate.ToString(), modulename); } catch (Exception ex) { throw new Exception(ex.Message); } } return(nflag > 0); }