Example #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);
            }
        }
Example #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);
        }
Example #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);
        }
Example #4
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);
        }
Example #5
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);
        }
Example #6
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);
        }
Example #7
0
        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);
        }
Example #8
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);
                }
            }
            //此处直接调用数据库操作接口,绕过中间层
            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);
        }
Example #9
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);
        }
Example #10
0
        private ObservableCollection <Mesage> GetData(int id)
        {
            var Datas = new ObservableCollection <Mesage>();

            TPipeInfo    tpipeinfo    = new TPipeInfo(App._dbpath, App.PassWord);
            TPipeExtInfo tpipeextinfo = new TPipeExtInfo(App._dbpath, App.PassWord);

            mPipeInfo    = tpipeinfo.Sel_PipeInfoByid(id);
            mPipeExtInfo = tpipeextinfo.Sel_PipeExtInfoByPipeId(id);
            if (mPipeInfo == null || mPipeExtInfo == null)
            {
                MessageBox.Show("读取管道数据失败");
                return(null);
            }

            Datas.Add(new Mesage {
                ItemName = "排水管标识码", ValueName = mPipeInfo.PipeName
            });
            Datas.Add(new Mesage {
                ItemName = "排水系统编码/路名", ValueName = mPipeExtInfo.Lane_Way
            });
            Datas.Add(new Mesage {
                ItemName = "管道类别", ValueName = GetCategoryName(mPipeInfo.Pipe_Category)
            });
            Datas.Add(new Mesage {
                ItemName = "起点编码", ValueName = GetJuncName(mPipeInfo.In_JunID)
            });
            Datas.Add(new Mesage {
                ItemName = "终点编码", ValueName = GetJuncName(mPipeInfo.Out_JunID)
            });
            Datas.Add(new Mesage {
                ItemName = "起点管顶标高", ValueName = Convert.ToString(mPipeInfo.In_UpEle)
            });
            Datas.Add(new Mesage {
                ItemName = "起点管底标高", ValueName = Convert.ToString(mPipeInfo.In_BottomEle)
            });
            Datas.Add(new Mesage {
                ItemName = "终点管顶标高", ValueName = Convert.ToString(mPipeInfo.Out_UpEle)
            });
            Datas.Add(new Mesage {
                ItemName = "终点管底标高", ValueName = Convert.ToString(mPipeInfo.Out_BottomEle)
            });
            Datas.Add(new Mesage {
                ItemName = "起点实测管径", ValueName = Convert.ToString(mPipeInfo.Shape_Data1)
            });
            Datas.Add(new Mesage {
                ItemName = "终点实测管径", ValueName = Convert.ToString(mPipeInfo.Shape_Data2)
            });
            Datas.Add(new Mesage {
                ItemName = "断面形式", ValueName = GetShapeType(mPipeInfo.ShapeType)
            });
            Datas.Add(new Mesage {
                ItemName = "断面数据", ValueName = mPipeInfo.ShapeData
            });
            Datas.Add(new Mesage {
                ItemName = "管道材质", ValueName = Getmaterial(mPipeInfo.Material)
            });
            Datas.Add(new Mesage {
                ItemName = "管顶糙率", ValueName = Convert.ToString(mPipeInfo.Roughness)
            });
            Datas.Add(new Mesage {
                ItemName = "数据来源", ValueName = GetDataSource(mPipeInfo.DataSource)
            });
            Datas.Add(new Mesage {
                ItemName = "数据获取时间", ValueName = Convert.ToString(mPipeInfo.Record_Date)
            });
            Datas.Add(new Mesage {
                ItemName = "填报单位", ValueName = mPipeInfo.ReportDept
            });
            Datas.Add(new Mesage {
                ItemName = "填报日期", ValueName = Convert.ToString(mPipeInfo.ReportDate)
            });
            Datas.Add(new Mesage {
                ItemName = "数据是否完整", ValueName = bool2str(mPipeExtInfo.DataIsFull)
            });
            Datas.Add(new Mesage {
                ItemName = "数据缺失原因", ValueName = mPipeExtInfo.LoseReason
            });
            Datas.Add(new Mesage {
                ItemName = "备注", ValueName = mPipeExtInfo.Remark
            });
            return(Datas);
        }