protected void btnSaveRefresh_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtTestItemName.Text.Trim())) { MessageBoxShow("请选择要操作的项", MessageBoxIcon.Information); return; } try { object[] keys = gvList.DataKeys[gvList.SelectedRowIndexArray[0]]; Dictlabandtest dictlabandtest = new Dictlabandtest(); dictlabandtest.Dictlabandtestid = TypeParse.StrToDouble(keys[0].ToString(), 0); dictlabandtest.Issendouttest = this.radlIssendouttest.SelectedValue.ToString(); dictlabandtest.Isactive = this.radlIsactive.SelectedValue.ToString(); dictlabandtest.Labname = DropDictLab.SelectedText; new DictlabandtestService().SaveDictlabandtest(dictlabandtest); MessageBoxShow("保存成功!"); } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } BindGrid(); }
/// <summary> /// 获取模块详细信息 /// </summary> /// <param name="usercode"></param> /// <returns></returns> public Dictlabandtest GetDictlabandtestInfo(Dictlabandtest dictFastComment) { //Dictlabandtest obj = null; //IList lst = this.selectIList("Dict.SelectDictlabandtestById", dictFastComment); //if (lst.Count > 0) // obj = (Dictlabandtest)lst[0]; //return obj; return(this.selectObj <Dictlabandtest>("Dict.SelectDictlabandtestById", dictFastComment)); }
///<summary> ///新增编辑后保存 ///</summary> ///<param name="library"></param> /// <returns></returns> public bool SaveDictlabandtest(Dictlabandtest dictlabandtest) { int nflag = 0; //新增 if (dictlabandtest.Dictlabandtestid == 0 || dictlabandtest.Dictlabandtestid == null) { try { dictlabandtest.Dictlabandtestid = getSeqID("SEQ_DICTLABANDTEST"); insert("Dict.InsertDictlabandtest", dictlabandtest); nflag = 1; List <LogInfo> logLst = getLogInfo <Dictlabandtest>(new Dictlabandtest(), dictlabandtest); Dictlab dictlab = new DictlabService().GetDictlabById(Convert.ToDouble(dictlabandtest.Dictlabid)); //查询分点 AddMaintenanceLog("Dictlabandtest", int.Parse(dictlabandtest.Dictlabandtestid.ToString()), logLst, "新增", dictlab.Labname, dictlabandtest.Createdate.ToString(), modulename); CacheHelper.RemoveAllCache("daan.GetDictlabandtest"); CacheHelper.RemoveAllCache("daan.GetDicttestitemNotDictlabandtest"); } catch (Exception ex) { nflag = 0; throw new Exception(ex.Message); } } else//保存 { try { Dictlabandtest oldDictlabandtest = GetDictlabandtestInfo(dictlabandtest); dictlabandtest.Createdate = oldDictlabandtest.Createdate; dictlabandtest.Dictlabid = oldDictlabandtest.Dictlabid; dictlabandtest.Dicttestitemid = oldDictlabandtest.Dicttestitemid; nflag = update("Dict.UpdateDictlabandtest", dictlabandtest); List <LogInfo> logLst = getLogInfo <Dictlabandtest>(oldDictlabandtest, dictlabandtest); Dictlab dictlab = new DictlabService().GetDictlabById(Convert.ToDouble(dictlabandtest.Dictlabid)); //查询分点 AddMaintenanceLog("Dictlabandtest", int.Parse(dictlabandtest.Dictlabandtestid.ToString()), logLst, "修改", dictlabandtest.Labname, dictlabandtest.Createdate.ToString(), modulename); CacheHelper.RemoveAllCache("daan.GetDictlabandtest"); CacheHelper.RemoveAllCache("daan.GetDicttestitemNotDictlabandtest"); } catch (Exception ex) { throw new Exception(ex.Message); } } return(nflag > 0); }
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) { dictlabandtest.Dictlabandtestid = Convert.ToInt32(keys[0]); if (dictlabandtest.Dictlabandtestid != 0) { List <Dictlabandtest> dictlabandtestList = loginservice.GetLoginDictlabandtest(); dictlabandtest = dictlabandtestList.Where <Dictlabandtest>(c => c.Dictlabandtestid == dictlabandtest.Dictlabandtestid).First <Dictlabandtest>(); DictlabId = Convert.ToDouble(dictlabandtest.Dictlabid); DicttestitemId = Convert.ToDouble(dictlabandtest.Dicttestitemid); BindGrid(); //DictlabId = 0; //dictCountedId = 0; //DicttestitemId = 0; //BindGrid(DictlabId); this.tbxFinalprice.Text = string.Empty; this.DatePicker1.Text = string.Empty; this.DatePicker2.Text = string.Empty; this.Form1.Title = "当前状态-新增"; } } } } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }