/// <summary> /// 根据ID获取详细信息 /// </summary> /// <param name="dictlabId"></param> /// <returns></returns> public Dictlibrary GetDictLibraryInfoById(string libraryId) { Dictlibrary dictLibrary = new Dictlibrary(); dictLibrary.Dictlibraryid = double.Parse(libraryId); return(GetDictLibraryInfo(dictLibrary)); }
//加载文本框数据至对象 protected void GetEditDate() { library = new Dictlibrary(); if (gvList.SelectedRowIndexArray.Length > 0) { object[] objValue = gvList.DataKeys[gvList.SelectedRowIndexArray[0]]; library.Dictlibraryid = TypeParse.StrToDouble(objValue[0], 0); } library.Librarycode = txtLibraryCode.Text.Trim(); library.Libraryname = txtLibraryName.Text.Trim(); }
////新增 //protected void btnAdd_Click(object sender, EventArgs e) //{ // gvList.SelectedRowIndexArray = new int[] { }; // SetEditDate(); //} ////保存 //protected void btnSave_Click(object sender, EventArgs e) //{ // //获取文本框值 // GetEditDate(); // if (libraryService.SaveDictLibrary(library)) // { // MessageBoxShow("保存数据成功!",MessageBoxIcon.Information); // gvList.SelectedRowIndexArray = new int[] {}; // BindGrid(); // CacheHelper.RemoveAllCache(); // } //} ////删除 //protected void btnDelAll_Click(object sender, EventArgs e) //{ // StringBuilder sb = new StringBuilder(); // foreach (int row in gvList.SelectedRowIndexArray) // { // sb.Append(gvList.DataKeys[row][0].ToString()); // sb.Append(","); // } // int nflag = libraryService.DelDictLibraryByID(sb.ToString().TrimEnd(',')); // if (nflag > 0) // { // MessageBoxShow("所选项已成功删除", MessageBoxIcon.Information); // gvList.SelectedRowIndexArray = new int[] { }; // BindGrid(); // CacheHelper.RemoveAllCache(); // } //} //加载当前行至编辑框 protected void SetEditDate() { //新增 library = new Dictlibrary(); //编辑 if (gvList.SelectedRowIndexArray.Length > 0) { object[] objValue = gvList.DataKeys[gvList.SelectedRowIndexArray[0]]; library.Dictlibraryid = TypeParse.StrToDouble(objValue[0], 0); library.Librarycode = TypeParse.ObjToStr(objValue[1], ""); library.Libraryname = TypeParse.ObjToStr(objValue[2], ""); } txtLibraryCode.Text = library.Librarycode; txtLibraryName.Text = library.Libraryname; }
/// <summary> /// 新增编辑后保存 /// </summary> /// <param name="library"></param> /// <returns></returns> public bool SaveDictLibrary(Dictlibrary library) { int nflag = 0; //新增 if (library.Dictlibraryid == 0) { try { library.Dictlibraryid = getSeqID("Seq_DictLibrary"); insert("Dict.InsertDictLibrary", library); nflag = 1; List <LogInfo> logLst = getLogInfo <Dictlibrary>(new Dictlibrary(), library); AddMaintenanceLog("Dictlibrary", int.Parse(library.Dictlibraryid.ToString()), logLst, "新增", library.Libraryname, library.Librarycode, modulename); } catch (Exception ex) { nflag = 0; throw new Exception(ex.Message); } } else//保存 { try { //获取待修改原始数据 Dictlibrary tempLibrary = new Dictlibrary(); tempLibrary.Dictlibraryid = library.Dictlibraryid; Dictlibrary olddictlibrary = GetDictLibraryInfo(tempLibrary); nflag = update("Dict.UpdateDictLibrary", library); List <LogInfo> logLst = getLogInfo <Dictlibrary>(olddictlibrary, library); AddMaintenanceLog("Dictlibrary", int.Parse(library.Dictlibraryid.ToString()), logLst, "修改", library.Libraryname, library.Librarycode, modulename); } catch (Exception ex) { throw new Exception(ex.Message); } } CacheHelper.RemoveAllCache("daan.GetDictLibraryLst"); return(nflag > 0); }
/// <summary> /// 按条件获取,为空时取全部 /// </summary> /// <param name="library"></param> /// <returns></returns> public IList <Dictlibrary> GetDictLibraryLst(Dictlibrary library) { return(this.QueryList <Dictlibrary>("Dict.GetDictLibraryLst", library)); }
/// <summary> /// 获取基础字典详细信息 /// </summary> /// <param name="usercode"></param> /// <returns></returns> public Dictlibrary GetDictLibraryInfo(Dictlibrary library) { return(this.selectObj <Dictlibrary>("Dict.GetDictLibraryLst", library)); }