/// <summary> /// 更新管道信息,对现有数据更新,如不更新其他数据则设为null /// </summary> /// <returns></returns> private bool DoUpdate() { TPipeInfo pipeinfo = new TPipeInfo(_dbpath, PassWord); TPipeExtInfo pipextinfo = new TPipeExtInfo(_dbpath, PassWord); TUSInfo usinfo = new TUSInfo(_dbpath, PassWord); pipeinfo.Update_PipeInfo(ListPipe); pipextinfo.Update_PipeExtInfo(ListPipeExt); usinfo.Update_USInfo(ListUS); return(true); }
public bool DoSave() { ObservableCollection <Mesage> datas = (ObservableCollection <Mesage>)DG1.DataContext; foreach (Mesage msg in datas) { try { ParseData(msg); } catch (Exception ex) { System.Console.WriteLine(ex.ToString()); string str = ""; if (ex is ExceptionProcess) { str += ((ExceptionProcess)ex).getReson() + "\n"; } MessageBox.Show(str + "设置数据格式错误:" + msg.ItemName + " " + msg.ValueName); return(false); } } //此处直接调用数据库操作接口,绕过中间层 TPipeInfo pipeinfo = new TPipeInfo(App._dbpath, App.PassWord); TPipeExtInfo pipextinfo = new TPipeExtInfo(App._dbpath, App.PassWord); List <CPipeInfo> pipelist = new List <CPipeInfo>(); pipelist.Add(mPipeInfo); List <CPipeExtInfo> extlist = new List <CPipeExtInfo>(); extlist.Add(mPipeExtInfo); bool b1 = pipeinfo.Update_PipeInfo(pipelist); bool b2 = pipextinfo.Update_PipeExtInfo(extlist); return(b1 & b2); }