Пример #1
0
        private bool DoQuickInsert()
        {
            TJuncInfo    juncinfo    = new TJuncInfo(_dbpath, PassWord);
            TJuncExtInfo juncextinfo = new TJuncExtInfo(_dbpath, PassWord);

            if (ListJunc == null)
            {
                return(false);
            }
            List <int> listid = new List <int>();         //for junction id list

            //asume that the junclist size equal juncextlist size
            if (!juncinfo.Insert_JuncInfo(ListJunc, ref listid))
            {
                return(false);
            }
            int nCount = 0;
            List <CJuncExtInfo> newlistext = new List <CJuncExtInfo>();

            foreach (CJuncExtInfo junc in ListJuncExt)
            {
                junc.JuncID = listid.ElementAt(nCount++);
                newlistext.Add(junc);
            }
            if (!juncextinfo.Insert_JuncExtInfo(newlistext))
            {
                return(false);
            }
            return(true);
        }
Пример #2
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);
        }
Пример #3
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);
        }