/// <summary> /// 导入管道信息,附加信息;但不会导入管道检测信息,管道日志,图片,报告,视频信息 /// </summary> /// <returns></returns> private bool DoLoad() { TPipeInfo pipeinfo = new TPipeInfo(_dbpath, PassWord); TPipeExtInfo pipextinfo = new TPipeExtInfo(_dbpath, PassWord); TUSInfo usinfo = new TUSInfo(_dbpath, PassWord); pipeinfo.OpenDB(); pipextinfo.OpenDB(); usinfo.OpenDB(); ListPipe = pipeinfo.Load_PipeInfo(); ListPipeExt = pipextinfo.Load_PipeExtInfo(); ListUS = usinfo.Load_USInfo(); pipeinfo.CloseDB(); pipextinfo.CloseDB(); usinfo.CloseDB(); if (ListPipe == null || ListPipeExt == null || ListUS == null) { return(false); } else { return(true); } }
private bool DoQuickInsert() { if (ListPipe == null || ListPipe.Count == 0) { if (ListUS != null && ListUS.Count > 0) { return(InsertUs()); } else { return(false); } } TPipeInfo pipeinfo = new TPipeInfo(_dbpath, PassWord); TPipeExtInfo pipextinfo = new TPipeExtInfo(_dbpath, PassWord); pipeinfo.OpenDB(); pipextinfo.OpenDB(); List <int> listid = new List <int>(); if (!pipeinfo.Insert_PipeInfo(ListPipe, ref listid)) { return(false); } int nCount = 0; List <CPipeExtInfo> newllist = new List <CPipeExtInfo>(); foreach (CPipeExtInfo pipe in ListPipeExt) { pipe.PipeID = listid.ElementAt(nCount++); newllist.Add(pipe); } if (!pipextinfo.Insert_PipeExtInfo(ListPipeExt)) { return(false); } pipeinfo.CloseDB(); pipextinfo.CloseDB(); return(true); }
/// <summary> /// 插入管道信息,和附加信息,管道检测信息,管道日志,图片,报告,视频信息 /// </summary> /// <returns></returns> private bool DoInsert() { if (ListPipe == null) { return(false); } TPipeInfo pipeinfo = new TPipeInfo(_dbpath, PassWord); TPipeExtInfo pipextinfo = new TPipeExtInfo(_dbpath, PassWord); TUSInfo usinfo = new TUSInfo(_dbpath, PassWord); pipeinfo.OpenDB(); pipextinfo.OpenDB(); usinfo.OpenDB(); int i = 0; foreach (CPipeInfo pipe in ListPipe) { CPipeInfo tmp = pipe; //插入附加信息 CPipeExtInfo extmp = null; if (!pipeinfo.Insert_PipeInfo(ref tmp)) { continue; } if (ListPipeExt == null || ListPipeExt.Count == 0) { extmp = new CPipeExtInfo(); } else { if (i < ListPipeExt.Count) { extmp = ListPipeExt.ElementAt(i); } else { extmp = new CPipeExtInfo(); } } extmp.PipeID = tmp.ID; pipextinfo.Insert_PipeExtInfo(ref extmp); //插入管道检测信息 CUSInfo ustmp = null; if (ListUS == null || ListUS.Count == 0) { ustmp = new CUSInfo(); } else { if (i < ListUS.Count) { ustmp = ListUS.ElementAt(i); } else { ustmp = new CUSInfo(); } } ustmp.PipeID = tmp.ID; usinfo.Insert_USInfo(ref ustmp); i++; } //close the db connection pipeinfo.CloseDB(); pipextinfo.CloseDB(); usinfo.CloseDB(); return(true); }