예제 #1
0
        /// <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);
            }
        }
예제 #2
0
        /// <summary>
        /// 删除管道的基本信息,同时删除其他关联信息,
        /// :附加信息,管道检测信息,管道日志,图片,报告,视频信息
        /// </summary>
        /// <returns></returns>
        private bool DoDelete()
        {
            TPipeInfo    pipeinfo   = new TPipeInfo(_dbpath, PassWord);
            TPipeExtInfo pipextinfo = new TPipeExtInfo(_dbpath, PassWord);
            TUSInfo      usinfo     = new TUSInfo(_dbpath, PassWord);

            if (ListPipe == null || ListPipe.Count == 0)
            {
                return(false);
            }

            foreach (CPipeInfo pipe in ListPipe)
            {
                pipeinfo.Delete_PipeInfo(pipe);

                CPipeExtInfo ext = null;
                ListPipeExt = pipextinfo.Sel_PipeExtInfo(pipe.ID);
                if (ListPipeExt != null && ListPipeExt.Count > 0)
                {
                    ext = ListPipeExt.ElementAt(0);
                }
                pipextinfo.Delete_PipeExtInfo(ext);

                CUSInfo us = null;
                ListUS = usinfo.Sel_USInfo(pipe.ID);
                if (ListUS != null && ListUS.Count > 0)
                {
                    us = ListUS.ElementAt(0);
                }
                usinfo.Delete_USInfo(us);
            }

            return(true);
        }
예제 #3
0
        /// <summary>
        /// 根据管道名称获取管道信息,附加信息;管道检测信息,管道日志,图片,报告,视频信息
        /// </summary>
        /// <returns></returns>
        private bool DoSelect()
        {
            if (PipeName == null || PipeName.Length <= 0)
            {
                return(false);
            }
            TPipeInfo    pipeinfo   = new TPipeInfo(_dbpath, PassWord);
            TPipeExtInfo pipextinfo = new TPipeExtInfo(_dbpath, PassWord);
            TUSInfo      usinfo     = new TUSInfo(_dbpath, PassWord);

            ListPipe = pipeinfo.Sel_PipeInfo(PipeName);
            if (ListPipe == null || ListPipe.Count <= 0)
            {
                return(false);
            }

            ListPipeExt = new List <CPipeExtInfo>();
            ListUS      = new List <CUSInfo>();

            foreach (CPipeInfo pipe in ListPipe)
            {
                int id = pipe.ID;
                List <CPipeExtInfo> list1 = pipextinfo.Sel_PipeExtInfo(id);
                if (list1 != null && list1.Count > 0)
                {
                    ListPipeExt.Add(list1.ElementAt(0));
                }
                List <CUSInfo> list2 = usinfo.Sel_USInfo(id);
                if (list2 != null && list2.Count > 0)
                {
                    ListUS.Add(list2.ElementAt(0));
                }
            }
            return(true);
        }
예제 #4
0
        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);
                }
            }

            TUSInfo        usinfo = new TUSInfo(App._dbpath, App.PassWord);
            List <CUSInfo> list   = new List <CUSInfo>();

            list.Add(mUSinfo);
            return(usinfo.Update_USInfo(list));
        }
예제 #5
0
        public void LoadRainPipe()
        {
            TPipeInfo        pipeinfo = new TPipeInfo(App._dbpath, App.PassWord);       //读取数据库
            List <CPipeInfo> pipelist = pipeinfo.Sel_PipeInfo((int)PIPETYPE.PIPE_RAIN); //仅仅读取雨水管道

            TUSInfo        usinfo = new TUSInfo(App._dbpath, App.PassWord);
            List <CUSInfo> uslist = usinfo.Load_USInfo();

            foreach (CPipeInfo info in pipelist)
            {
                RainPipe  pipe     = null;
                RainCover starjunc = FindStartRJunc(info);                    //找到起始点坐标
                RainCover endjunc  = FindEndRJunc(info);                      //找到终止点坐标
                if (starjunc == null || endjunc == null)
                {
                    continue;
                }

                pipe = new RainPipe(starjunc, endjunc);

                pipe.pipeInfo = info;
                pipe.UsInfo   = FindUSInfo(uslist, info.ID);
                RainPipeList.Add(pipe);
            }
        }
예제 #6
0
        public void LoadWasterPipe()
        {
            TPipeInfo        pipeinfo = new TPipeInfo(App._dbpath, App.PassWord);        //读取数据库
            List <CPipeInfo> pipelist = pipeinfo.Sel_PipeInfo((int)PIPETYPE.PIPE_WASTE); //仅仅读取污水管道

            //读取管道内窥数据
            TUSInfo        usinfo = new TUSInfo(App._dbpath, App.PassWord);
            List <CUSInfo> uslist = usinfo.Load_USInfo();

            foreach (CPipeInfo info in pipelist)
            {
                WastePipe  pipe     = null;
                WasteCover starjunc = FindStartWJunc(info);                    //找到起始点坐标
                WasteCover endjunc  = FindEndWJunc(info);                      //找到终止点坐标
                if (starjunc == null || endjunc == null)
                {
                    continue;
                }

                pipe = new WastePipe(starjunc, endjunc);

                pipe.pipeInfo = info;
                pipe.UsInfo   = FindUSInfo(uslist, info.ID);
                WastePipeList.Add(pipe);
            }
        }
예제 #7
0
        protected int InsterDb(Pipe pipe, Cover injunc, Cover outjunc)
        {
            CPipeInfo    pipeInfo    = new CPipeInfo();
            CPipeExtInfo pipeExtInfo = new CPipeExtInfo();
            CUSInfo      UsInfo      = new CUSInfo();

            pipeInfo.PipeName  = pipe.Name;
            pipeInfo.In_JunID  = injunc.juncInfo.ID;
            pipeInfo.Out_JunID = outjunc.juncInfo.ID;

            pipeInfo.Pipe_Category = pipe.pipeInfo.Pipe_Category;
            UsInfo.Struct_Class    = 0;

            TPipeInfo    tpipeinfo   = new TPipeInfo(App._dbpath, App.PassWord);
            TPipeExtInfo tpipextinfo = new TPipeExtInfo(App._dbpath, App.PassWord);
            TUSInfo      tusinfo     = new TUSInfo(App._dbpath, App.PassWord);

            tpipeinfo.Insert_PipeInfo(ref pipeInfo);
            pipeExtInfo.PipeID = pipeInfo.ID;
            tpipextinfo.Insert_PipeExtInfo(ref pipeExtInfo);
            UsInfo.PipeID = pipeInfo.ID;
            tusinfo.Insert_USInfo(ref UsInfo);

            return(pipeInfo.ID);
        }
예제 #8
0
        private bool InsertUs()
        {
            TUSInfo usinfo = new TUSInfo(_dbpath, PassWord);

            usinfo.OpenDB();
            bool ret = usinfo.Insert_USInfo(ListUS);

            usinfo.CloseDB();
            return(ret);
        }
예제 #9
0
        private bool DoClear()
        {
            TPipeInfo    pipeinfo   = new TPipeInfo(_dbpath, PassWord);
            TPipeExtInfo pipextinfo = new TPipeExtInfo(_dbpath, PassWord);
            TUSInfo      usinfo     = new TUSInfo(_dbpath, PassWord);

            pipeinfo.Clear_PipeInfo();
            pipextinfo.Clear_PipeExtInfo();
            usinfo.Clear_USInfo();
            return(true);
        }
예제 #10
0
        /// <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);
        }
예제 #11
0
        /// <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);
        }
예제 #12
0
        private ObservableCollection <Mesage> GetData(int id)
        {
            var Datas = new ObservableCollection <Mesage>();

            TUSInfo tusinfo = new TUSInfo(App._dbpath, App.PassWord);

            mUSinfo = tusinfo.Sel_USInfoByPipeid(id);
            if (mUSinfo == null)
            {
                MessageBox.Show("读取内窥数据失败");
                return(null);
            }

            Datas.Add(new Mesage {
                ItemName = "排水管标识码", ValueName = "-"
            });
            Datas.Add(new Mesage {
                ItemName = "作业编号", ValueName = mUSinfo.JobID
            });
            Datas.Add(new Mesage {
                ItemName = "检测日期", ValueName = Convert.ToString(mUSinfo.DetectDate)
            });
            Datas.Add(new Mesage {
                ItemName = "检测单位", ValueName = mUSinfo.DetectDep
            });
            Datas.Add(new Mesage {
                ItemName = "检测操作人员", ValueName = mUSinfo.Detect_Person
            });
            Datas.Add(new Mesage {
                ItemName = "检测单位联系方式", ValueName = mUSinfo.Contacts
            });
            Datas.Add(new Mesage {
                ItemName = "检测方法", ValueName = GetCheckMethod(mUSinfo.Detect_Method)
            });
            Datas.Add(new Mesage {
                ItemName = "检测方向", ValueName = GetCheckDir(mUSinfo.Detect_Dir)
            });
            Datas.Add(new Mesage {
                ItemName = "封堵情况", ValueName = mUSinfo.Pipe_Stop
            });
            Datas.Add(new Mesage {
                ItemName = "功能性缺失", ValueName = GetFuncDef(mUSinfo.Func_Defect)
            });
            Datas.Add(new Mesage {
                ItemName = "功能性缺失等级", ValueName = GetClass(mUSinfo.Func_Class)
            });
            Datas.Add(new Mesage {
                ItemName = "结构性缺陷", ValueName = GetStructDef(mUSinfo.Strcut_Defect)
            });
            Datas.Add(new Mesage {
                ItemName = "结构性缺陷等级", ValueName = GetClass(mUSinfo.Struct_Class)
            });
            Datas.Add(new Mesage {
                ItemName = "修复指数RI", ValueName = Convert.ToString(mUSinfo.Repair_Index)
            });
            Datas.Add(new Mesage {
                ItemName = "养护指数MI", ValueName = Convert.ToString(mUSinfo.Matain_Index)
            });
            Datas.Add(new Mesage {
                ItemName = "缺陷描述", ValueName = mUSinfo.Problem
            });
            Datas.Add(new Mesage {
                ItemName = "检测影像文件的文件", ValueName = mUSinfo.Video_Filename
            });
            Datas.Add(new Mesage {
                ItemName = "数据填报单位", ValueName = Convert.ToString(mUSinfo.ReportDept)
            });
            Datas.Add(new Mesage {
                ItemName = "填报日期", ValueName = Convert.ToString(mUSinfo.ReportDate)
            });
            Datas.Add(new Mesage {
                ItemName = "数据是否完整", ValueName = bool2str(mUSinfo.DataIsFull)
            });
            Datas.Add(new Mesage {
                ItemName = "数据缺失原因", ValueName = mUSinfo.LoseReason
            });
            Datas.Add(new Mesage {
                ItemName = "备注", ValueName = mUSinfo.Remark
            });
            return(Datas);
        }