Пример #1
0
 public MasterCollection FetchAll()
 {
     MasterCollection coll = new MasterCollection();
     Query qry = new Query(Master.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
Пример #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <MasterInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(MasterInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <MasterInfo>);
            }
            else
            {
                List <MasterInfo> list       = new List <MasterInfo>();
                MasterCollection  collection = new  MasterCollection();
                Query             qry        = new Query(Master.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (Master master in collection)
                {
                    MasterInfo masterInfo = new MasterInfo();
                    LoadFromDAL(masterInfo, master);
                    list.Add(masterInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(MasterInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
Пример #3
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List <MasterInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <MasterInfo> list = new List <MasterInfo>();

            Query q = Master.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            MasterCollection collection = new  MasterCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (Master master  in collection)
            {
                MasterInfo masterInfo = new MasterInfo();
                LoadFromDAL(masterInfo, master);
                list.Add(masterInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
Пример #4
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List <MasterInfo> pList, MasterCollection pCollection)
 {
     foreach (Master master in pCollection)
     {
         MasterInfo masterInfo = new MasterInfo();
         LoadFromDAL(masterInfo, master);
         pList.Add(masterInfo);
     }
 }
Пример #5
0
    public static void ObjectCreate()
    {
        MasterCollection loadSettingData = CreateInstance <MasterCollection> ();
        string           path            = SystemSetting.GetScriptableobjectPath() + "MasterCollectionAsset" + ".asset";

        AssetDatabase.CreateAsset(loadSettingData, path);
        AssetDatabase.ImportAsset(path);
        EditorUtility.UnloadUnusedAssets();
    }
Пример #6
0
        /// <summary>
        /// Called when the collection is being closed
        /// </summary>
        internal void OnClose()
        {
            MasterCollection.Dispatcher.VerifyAccess();
            MasterCollection.RaiseDisconnected();

            foreach (ObjectEntry entry in this.Items.Values)
            {
                entry.RemoveParent(this.Id);
            }
            this.Items.Clear();
            this.SetConnected(false, false);

            try
            {
                ignoreChanges = true;
                MasterCollection.ClearSharedCollection();
            }
            finally
            {
                ignoreChanges = false;
            }
        }
Пример #7
0
    public static void CreateComponents(Type _type)
    {
        string name       = "target";
        string outputPath = SystemSetting.GetAssetSrcPath() + _type.Name + "Prefab.prefab";


        GameObject gameObject = EditorUtility.CreateGameObjectWithHideFlags(
            name,
            HideFlags.HideInHierarchy,
            typeof(MasterCollectionDataHolder)
            );

        //プレハブにスクリプタブルオブジェクトを設置
        UnityEngine.Object[] assets;

        string assetName = SystemSetting.GetResourcesLoadPath() + _type.Name + "Asset";

        assets = Resources.LoadAll(assetName);
        Debug.LogWarning("GetObj :" + assetName.ToString());


        MasterCollection tmp = new MasterCollection();

        foreach (UnityEngine.Object asset in assets)
        {
            if (asset is MasterCollection)
            {
                tmp = (MasterCollection)asset;
            }
        }

        MasterCollectionDataHolder holder = gameObject.GetComponent <MasterCollectionDataHolder> ();

        holder.assetBundleData = tmp;
        SetAssetBundleInfo(gameObject);

        PrefabUtility.CreatePrefab(outputPath, gameObject, ReplacePrefabOptions.ReplaceNameBased);
        Editor.DestroyImmediate(gameObject);
    }
Пример #8
0
        public static void Run()
        {
            // ExStart:CopyShape
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Load a source Visio
            Diagram srcVisio = new Diagram(dataDir + "Drawing1.vsdx");

            // Initialize a new Visio
            Diagram newDiagram = new Diagram();

            // Add all masters from the source Visio diagram
            MasterCollection originalMasters = srcVisio.Masters;

            foreach (Master master in originalMasters)
            {
                newDiagram.AddMaster(srcVisio, master.Name);
            }

            // Get the page object from the original diagram
            Aspose.Diagram.Page SrcPage = srcVisio.Pages.GetPage("Page-1");
            // Copy themes from the source diagram
            newDiagram.CopyTheme(srcVisio);
            // Copy pagesheet of the source Visio page
            newDiagram.Pages[0].PageSheet.Copy(SrcPage.PageSheet);

            // Copy shapes from the source Visio page
            foreach (Aspose.Diagram.Shape shape in SrcPage.Shapes)
            {
                newDiagram.Pages[0].Shapes.Add(shape);
            }
            // Save the new Visio
            newDiagram.Save(dataDir + "CopyShapes_Out.vsdx", SaveFileFormat.VSDX);
            // ExEnd:CopyShape
        }
Пример #9
0
 public MasterCollection FetchByQuery(Query qry)
 {
     MasterCollection coll = new MasterCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
Пример #10
0
 public MasterCollection FetchByID(object MasterID)
 {
     MasterCollection coll = new MasterCollection().Where("MasterID", MasterID).Load();
     return coll;
 }
Пример #11
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< MasterInfo> pList, MasterCollection pCollection)
 {
     foreach (Master master in pCollection)
     {
         MasterInfo masterInfo = new MasterInfo();
         LoadFromDAL(masterInfo, master );
         pList.Add(masterInfo);
     }
 }
Пример #12
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List<MasterInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< MasterInfo> list = new List< MasterInfo>();

            Query q = Master .CreateQuery();
            q.PageIndex = pPageIndex;
            q.PageSize = pPageSize;
            q.ORDER_BY(pSortExpression,pOrderBy.ToString());
            MasterCollection  collection=new  MasterCollection();
             	collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (Master  master  in collection)
            {
                MasterInfo masterInfo = new MasterInfo();
                LoadFromDAL(masterInfo,   master);
                list.Add(masterInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
Пример #13
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<MasterInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(MasterInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< MasterInfo>;
     }
     else
     {
         List< MasterInfo>  list =new List< MasterInfo>();
         MasterCollection  collection=new  MasterCollection();
         Query qry = new Query(Master.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(Master master in collection)
         {
             MasterInfo masterInfo= new MasterInfo();
             LoadFromDAL(masterInfo,master);
             list.Add(masterInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(MasterInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }