Exemplo n.º 1
0
        private List <T> getObjectByIds <T>(string project, int[] ids)
            where T : DGObject, new()
        {
            if (!FileUtil.projectExit(project))
            {
                throw new iS3Exception(string.Format("{0}工程不存在", project));
            }

            GeologyRepo repo = new GeologyRepo(project);

            List <T> objs = new List <T>();

            foreach (int id in ids)
            {
                T obj = repo.getObjectById <T>(id);
                if (obj == null)
                {
                    T obj1 = new T();
                    obj1.id = id;
                    objs.Add((T)obj1);
                }
                else
                {
                    objs.Add((T)obj);
                }
            }
            return(objs);
        }
Exemplo n.º 2
0
        private T getObjectById <T>(string project, int id)
            where T : DGObject
        {
            if (!FileUtil.projectExit(project))
            {
                throw new iS3Exception(string.Format("{0}工程不存在", project));
            }

            GeologyRepo repo = new GeologyRepo(project);
            T           obj  = repo.getObjectById <T>(id);

            if (obj == null)
            {
                throw new iS3Exception(string.Format("没有找到id={0}的对象", id));
            }

            return(obj);
        }