Esempio n. 1
0
        private ObservableCollection<JuncMesage> GetData(int id)
        {
            var Datas = new ObservableCollection<JuncMesage>();

            SelectCmd scmd = new SelectCmd();
            JuncRev rev = new JuncRev();

            rev.ID = id;
            scmd.SetReceiver(rev);
            scmd.Execute();
            if (rev.ListJunc == null || rev.ListJunc.Count <= 0)
                return null;
            mJunc = rev.ListJunc.ElementAt(0);
            mJuncext = rev.ListJuncExt.ElementAt(0);

            Datas.Add(new JuncMesage { ItemName = "井盖名称", ValueName = mJunc.JuncName });
            Datas.Add(new JuncMesage { ItemName = "道路名称", ValueName = mJuncext.Lane_Way });
            Datas.Add(new JuncMesage { ItemName = "经度", ValueName = Convert.ToString(mJunc.X_Coor) });
            Datas.Add(new JuncMesage { ItemName = "纬度", ValueName = Convert.ToString(mJunc.Y_Coor) });
            Datas.Add(new JuncMesage { ItemName = "检查井类别", ValueName = GetCategoryName(mJunc.Junc_Category) });
            Datas.Add(new JuncMesage { ItemName = "检查井类型", ValueName = GetType(mJunc.Junc_Type) });
            Datas.Add(new JuncMesage { ItemName = "检查井形式", ValueName = GetStyle(mJunc.Junc_Style) });
            Datas.Add(new JuncMesage { ItemName = "井深", ValueName = GetDepth(mJunc.Depth) });

            Datas.Add(new JuncMesage { ItemName = "井盖所处的地面高程", ValueName = GetDepth(mJunc.Surface_Ele) });
            Datas.Add(new JuncMesage { ItemName = "数据来源", ValueName = GetDataSource(mJunc.DataSource) });
            Datas.Add(new JuncMesage { ItemName = "数据填报单位", ValueName = mJunc.ReportDept });
            Datas.Add(new JuncMesage { ItemName = "数据填报时间", ValueName = Convert.ToString(mJunc.Record_Date) });
            Datas.Add(new JuncMesage { ItemName = "管道是否暗接", ValueName = bool2str(mJunc.Junc_Darkjoint) });

            Datas.Add(new JuncMesage { ItemName = "污水是否直排", ValueName = bool2str(mJunc.Sewage_Line) });
            Datas.Add(new JuncMesage { ItemName = "井盖错误", ValueName = bool2str(mJunc.Junc_Error) });
            Datas.Add(new JuncMesage { ItemName = "CCTV检测编号", ValueName = mJunc.CCTV_CheckCode });
            Datas.Add(new JuncMesage { ItemName = "数据是否完整", ValueName = bool2str(mJunc.FullData) });
            Datas.Add(new JuncMesage { ItemName = "数据缺失原因", ValueName = mJunc.LoseReson });

            Datas.Add(new JuncMesage { ItemName = "A上游井口至管顶距离", ValueName = GetDepth(mJunc.Dis[0]) });
            Datas.Add(new JuncMesage { ItemName = "A上游井口至管底距离", ValueName = GetDepth(mJunc.Dis[1]) });
            Datas.Add(new JuncMesage { ItemName = "A下游井口至管顶距离", ValueName = GetDepth(mJunc.Dis[2]) });
            Datas.Add(new JuncMesage { ItemName = "A下游井口至管底距离", ValueName = GetDepth(mJunc.Dis[3]) });
            Datas.Add(new JuncMesage { ItemName = "B上游井口至管顶距离", ValueName = GetDepth(mJunc.Dis[4]) });
            Datas.Add(new JuncMesage { ItemName = "B上游井口至管底距离", ValueName = GetDepth(mJunc.Dis[5]) });
            Datas.Add(new JuncMesage { ItemName = "B下游井口至管顶距离", ValueName = GetDepth(mJunc.Dis[6]) });
            Datas.Add(new JuncMesage { ItemName = "B下游井口至管底距离", ValueName = GetDepth(mJunc.Dis[7]) });

            Datas.Add(new JuncMesage { ItemName = "备注", ValueName = mJuncext.Remark });


            return Datas;
        }
Esempio n. 2
0
        /// <summary>
        /// 在表中插入juncExtIndfo,并返回插入的ID
        /// </summary>
        /// <param name="junc"></param>
        /// <returns></returns>
        public bool Insert_JuncExtInfo(ref CJuncExtInfo junc)
        {
            MySqlDataReader reader;
            string strcmd = "INSERT INTO JunExtInfo (JuncID,Anci_Fac,Lane_Way,Cov_Material,Cov_Shape,Cov_Dimen1,Cov_Dimen2,"+
            "Cov_Dimen3,Chamber_Type,Chamber_Length,Chamber_Width,Chamber_Height,Survery_WaterDeep,Survery_SediDeep,Survery_Date,"+
            "Bottom_Style,Junc_Class,Status,Remark) values("+junc.JuncID+",'"+junc.Anci_Fac+"','"+junc.Lane_Way+"', "+junc.Cov_Material
            +" , "+junc.Cov_Shape+" ,'"+junc.Cov_Dimen1+"','"+junc.Cov_Dimen2+"','"+junc.Cov_Dimen3+"','"+junc.Chamber_Type+"','"+junc.Chamber_Length
            + "','" + junc.Chamber_Width + "','" + junc.Chamber_Height + "','" + junc.Survery_WaterDeep+"','"+junc.Survery_SediDeep+
            "','"+Convert.ToString(junc.Survery_Date)+"', "+junc.Bottom_Style+" , "+junc.Junc_Class+" , "+junc.Status+" ,'"+junc.Remark+"')";
            try
            {
                connect.Open();
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection = connect;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = strcmd;

                //strcmd = "SELECT MAX(ID) AS MAXID FROM JunExtInfo";
                cmd.ExecuteNonQuery();
                cmd.CommandText = "SELECT MAX(ID) AS MAXID FROM JunExtInfo";
                reader = cmd.ExecuteReader();
                reader.Read();
                junc.ID = Convert.ToInt32(reader[0].ToString());
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
                return false;
            }
            finally
            {
                connect.Close();
            }
            return true;
        }
Esempio n. 3
0
        private List<CJuncExtInfo> Select(string cmd)
        {
            List<CJuncExtInfo> listjunc = new List<CJuncExtInfo>();
            MySqlCommand com;
            MySqlDataReader reader;

            try
            {
                connect.Open();
                com = new MySqlCommand(cmd, connect);
                reader = com.ExecuteReader();
                while (reader.Read())
                {
                    CJuncExtInfo junc = new CJuncExtInfo();
                    int i = 0;
                    string tmp;
                    junc.ID = Convert.ToInt32(reader[i++].ToString());
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.JuncID = Convert.ToInt32(tmp);
                    junc.Anci_Fac = reader[i++].ToString();
                    junc.Lane_Way = reader[i++].ToString();
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                         junc.Cov_Material = Convert.ToInt32(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Cov_Shape = Convert.ToInt32(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Cov_Dimen1 = Convert.ToDouble(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Cov_Dimen2 = Convert.ToDouble(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Cov_Dimen3 = Convert.ToDouble(tmp);
                    junc.Chamber_Type = reader[i++].ToString();
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Chamber_Length = Convert.ToDouble(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Chamber_Width = Convert.ToDouble(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Chamber_Height = Convert.ToDouble(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Survery_WaterDeep = Convert.ToDouble(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Survery_SediDeep = Convert.ToDouble(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Survery_Date = Convert.ToDateTime(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Bottom_Style = Convert.ToInt32(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Junc_Class = Convert.ToInt32(tmp);
                    tmp = reader[i++].ToString();
                    if (tmp != null && tmp.Length > 0)
                        junc.Status = Convert.ToInt32(tmp);
                    junc.Remark = reader[i++].ToString();
                    listjunc.Add(junc);
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
                return null;
            }
            finally
            {
                connect.Close();
            }

            return listjunc;
        }
Esempio n. 4
0
 /// <summary>
 /// 删除指定juncExt info
 /// </summary>
 /// <param name="cmd"></param>
 /// <returns></returns>
 public bool Delete_JuncExtInfo(CJuncExtInfo junc)
 {
     List<string> listcmd = new List<string>();
     try
     {
         string cmd = "DELETE  FROM JunExtInfo where ID = " + junc.ID;
         listcmd.Add(cmd);
         ExectueCmd(listcmd);
     }
     catch (System.Exception ex)
     {
         Console.WriteLine(ex.Message);
         return false;
     }
     return true;
 }
Esempio n. 5
0
        /// <summary>
        /// 插入检查井信息,同时插入对应的检查井附加信息,若不存在附加信息
        /// 则创建新的信息
        /// </summary>
        /// <returns></returns>
        private bool DoInsert()
        {
            TJuncInfo juncinfo = new TJuncInfo(_dbpath, PassWord);
            TJuncExtInfo juncextinfo = new TJuncExtInfo(_dbpath, PassWord);

            if (ListJunc == null)
                return false;
            int i =0;
            foreach (CJuncInfo junc in ListJunc)
            {
                CJuncInfo tmp = junc;
                if (!juncinfo.Insert_JuncInfo(ref tmp))
                    continue;
                CJuncExtInfo extmp = null;
                if (ListJuncExt == null || ListJuncExt.Count == 0)
                {
                    extmp = new CJuncExtInfo();
                }
                else
                {
                    if (i < ListJuncExt.Count)
                        extmp = ListJuncExt.ElementAt(i);
                    else
                        extmp = new CJuncExtInfo();
                }
                extmp.JuncID = tmp.ID;
                juncextinfo.Insert_JuncExtInfo(ref extmp);
                i++;
            }
            if (i <= 0)
                return false;
            return true;
        }
Esempio n. 6
0
         //返回插入junction的id
        protected int InsterDB(Cover c)
        {
            if (c == null) return 0;
            //change the coordinate Mercator to WGS84
            Coords.Point p = new Coords.Point();
            p.x = c.Location.X;
            p.y = c.Location.Y;
            p = Coords.Mercator2WGS84(p);
            //store to 
            CJuncInfo info = new CJuncInfo();
            info.X_Coor = p.x + Constants.COOR_X_OFFSET;
            info.Y_Coor = p.y + Constants.COOR_Y_OFFSET;

            info.Junc_Category = c.juncInfo.Junc_Category;

            //数据库操作
            TJuncInfo juncinfo = new TJuncInfo(App._dbpath, App.PassWord);
            TJuncExtInfo juncextinfo = new TJuncExtInfo(App._dbpath, App.PassWord);
            if (!juncinfo.Insert_JuncInfo(ref info)) {
                return 0;
            }
            CJuncExtInfo extinfo = new CJuncExtInfo();
            extinfo.JuncID = info.ID;
            juncextinfo.Insert_JuncExtInfo(ref extinfo);
            return info.ID;
        }
Esempio n. 7
0
        private bool SaverTodb(List<JuncSheetData> list)
        {
            if (list == null || list.Count <= 0)
                return false;

            QuickInsert qicm = new QuickInsert();
            JuncRev rev = new JuncRev();
            rev.ListJunc = new List<CJuncInfo>();
            rev.ListJuncExt = new List<CJuncExtInfo>();

            foreach (JuncSheetData data in list)
            {
                CJuncInfo info = new CJuncInfo();
                CJuncExtInfo extinfo = new CJuncExtInfo();

                extinfo.Lane_Way = data.RoadName;
                info.JuncName = data.JuncName;
                info.Junc_Category = GetCategory(data.JuncCategory);
                info.Junc_Type = GetType(data.JuncType);
                info.Y_Coor = data.Latitude;
                info.X_Coor = data.Longitude;
                info.Surface_Ele = data.Height;
                info.Junc_Style = GetStyle(data.JuncStyle);

                info.Depth = data.Depth;
                info.Junc_Darkjoint = data.JuncDarkjoint;
                info.Sewage_Line = data.SewageLine;
                info.Junc_Error = data.JuncError;

                info.CCTV_CheckCode = data.CCTV_CheckCode;
                info.DataSource = GetDataSource(data.DataSource);
                info.Record_Date = data.DataTime;

                info.ReportDept = data.RecordDept;
                info.ReportDate = data.RecordTime;

                for (int i = 0; i < 8;i++ )
                {
                    info.Dis[i] = data.Dis[i];
                }

                    info.FullData = data.DataFull;
                info.LoseReson = data.LoseReson;

                extinfo.Remark = data.Remark;
                rev.ListJunc.Add(info);
                rev.ListJuncExt.Add(extinfo);
            }
            qicm.SetReceiver(rev);
            qicm.Execute();

            return true;
        }