/// <summary> /// 删除 /// </summary> /// <param name="usercode"></param> /// <returns></returns> public int DelDictlabdeptByID(string strId) { int nflag = 0; try { var arrayId = strId.Split(','); //临时存储待删除对象,备写日志用 List <Dictlabdept> dictLibraryList = new List <Dictlabdept>(); foreach (string strid in arrayId) { Dictlabdept dictlabdept = new Dictlabdept(); dictlabdept.Dictlabdeptid = Convert.ToDouble(strid); dictLibraryList.Add(GetDictlabdeptInfo(dictlabdept)); } nflag = this.delete("Dict.DeleteDictlabdept", strId); //记录日志 foreach (Dictlabdept item in dictLibraryList) { //增加删除日志对象 fhp List <LogInfo> logLst = getLogInfo <Dictlabdept>(item, new Dictlabdept()); AddMaintenanceLog("Dictlabdept", item.Dictlabdeptid, logLst, "删除", item.Labdeptname, item.Createdate.ToString(), modulename); } } catch (Exception ex) { throw new Exception(ex.Message); } CacheHelper.RemoveAllCache("daan.SelectDictlabdeptLst"); return(nflag); }
protected void gvList_RowClick(object sender, GridRowClickEventArgs e) { try { if (e.RowIndex >= 0) { int gridRowID = e.RowIndex; object[] keys = gvList.DataKeys[e.RowIndex]; //根据选中的行得到当前选中的实例 if (Convert.ToInt32(keys[0]) != 0) { dictlabdep = new Dictlabdept(); dictlabdep.Dictlabdeptid = TypeParse.StrToDouble(keys[0], 0); if (dictlabdep.Dictlabdeptid != 0) { this.tbxLabdeptname.Text = TypeParse.ObjToStr(keys[1], ""); this.Drop_LabdeptTyped.SelectedValue = TypeParse.ObjToStr(keys[2], ""); SimpleFormEdit.Title = "当前状态-编辑"; } } } } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
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="usercode"></param> /// <returns></returns> public Dictlabdept GetDictlabdeptInfo(Dictlabdept library) { //Dictlabdept obj = null; //IList lst = this.selectIList("Dict.GetDictlabdeptInfo", library); //if (lst.Count > 0) // obj = (Dictlabdept)lst[0]; //return obj; return(this.selectObj <Dictlabdept>("Dict.GetDictlabdeptInfo", library)); }
//保存数据的逻辑 public bool SaveDictlibrary() { try { dictlabdep = new Dictlabdept(); if (gvList.SelectedRowIndexArray.Length > 0) { object[] objValue = gvList.DataKeys[gvList.SelectedRowIndexArray[0]]; dictlabdep.Dictlabdeptid = TypeParse.StrToDouble(objValue[0], 0); } if (this.tbxLabdeptname.Text.Trim() != "") { dictlabdep.Labdeptname = this.tbxLabdeptname.Text.Trim(); } else { erreyType = "科室名称不能为空!"; return(false); } if (this.Drop_LabdeptTyped.SelectedValue != "-1") { dictlabdep.Labdepttype = this.Drop_LabdeptTyped.SelectedValue; } else { erreyType = "科室类型不能为空!"; return(false); } if (dictlabdep.Dictlabdeptid == 0 || dictlabdep.Dictlabdeptid == null) { dictlabdep.Createdate = DateTime.Now; } else { Dictlabdept dictdepback = new DictlabdeptService().GetDictlabdeptInfo(dictlabdep); dictlabdep.Createdate = dictdepback.Createdate; } return(dictlabedpService.SaveDictlabdept(dictlabdep)); } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); return(false); } }
///<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); }
///<summary> ///新增编辑后保存 ///</summary> ///<param name="library"></param> /// <returns></returns> public bool SaveDictlabdept(Dictlabdept library) { int nflag = 0; //新增 if (library.Dictlabdeptid == 0 || library.Dictlabdeptid == null) { try { library.Dictlabdeptid = getSeqID("SEQ_DICTLABDEPT"); insert("Dict.InsertDictlabdept", library); CacheHelper.RemoveAllCache("daan.GetDictlabandtest"); nflag = 1; List <LogInfo> logLst = getLogInfo <Dictlabdept>(new Dictlabdept(), library); AddMaintenanceLog("Dictlabdept", int.Parse(library.Dictlabdeptid.ToString()), logLst, "新增", library.Labdeptname, library.Createdate.ToString(), modulename); } catch (Exception ex) { nflag = 0; throw new Exception(ex.Message); } } else//保存 { try { Dictlabdept olddictfastcomment = GetDictlabdeptInfo(library); nflag = update("Dict.UpdateDictlabdept", library); List <LogInfo> logLst = getLogInfo <Dictlabdept>(olddictfastcomment, library); AddMaintenanceLog("Dictlabdept", int.Parse(library.Dictlabdeptid.ToString()), logLst, "修改", library.Labdeptname, library.Createdate.ToString(), modulename); } catch (Exception ex) { throw new Exception(ex.Message); } } CacheHelper.RemoveAllCache("daan.SelectDictlabdeptLst"); return(nflag > 0); }