Esempio n. 1
0
 public ResponseResult GetAllModels(int id)
 {
     try
     {
         using (DBEntitiesModel db = new DBEntitiesModel())
         {
             var data = db.Devices.Where(x => x.ParentID == id && x.IsActive == true).
                        Select(y => new DeviceDTO
             {
                 DeviceID    = y.DeviceID,
                 DeviceName  = y.DeviceName,
                 Description = y.Description,
                 ImageName   = y.ImageName,
                 IsActive    = y.IsActive,
                 ParentID    = y.ParentID,
                 CreatedBy   = y.CreatedBy,
                 CreatedOn   = y.CreatedOn
             }
                               ).ToList();
             return(ResponseResult.GetSuccessObject(data));
         }
     }
     catch (Exception exp) {
         return(ResponseResult.GetErrorObject());
     }
 }
 public DataService()
 {
     DB = new DBEntitiesModel();
 }
Esempio n. 3
0
        public void Execute(object parameter)
        {
            Type t = parameter as Type;

            //to create the objects i need the parameter data!!!!
            //         mpm.Save();
            //if (t.Name == "VEXZipArchive")
            //{
            //    mpm.Items.Add(new VEXZipArchive() { Parent = mpm, UnityContainer = mpm.UnityContainer, Name = "Unknown.zip" });
            //   // Type instance = (Type)Activator.CreateInstance(t);
            //   // object obj = t.GetConstructor(new Type[] { }).Invoke(new object[] { });
            // //   mpm.Items.Add(obj as IItem);
            //}
            if (t.Name == "VEXDBFileModel")
            {
                VEXDBFileModel dbData = new VEXDBFileModel()
                {
                    Parent = mpm, Name = "DBFile"
                };

                DBEntitiesModel objects = new DBEntitiesModel()
                {
                    Parent = dbData, Name = "Entities"
                };
                objects.IsExpanded = true;


                // EntityCategoryModel staticObjects = new EntityCategoryModel() { Parent = dbData, Name = "EntityCategory" };
                // objects.Items.Add(staticObjects);
                //CharacterCategoryModel characterObjects = new CharacterCategoryModel() { Parent = dbData, Name = "Characters" };
                //objects.Items.Add(characterObjects);

                //SpawnPointCategoryModel allSpawns = new SpawnPointCategoryModel() { Parent = dbData, Name = "SpawnPoints" };
                //SpawnPointCategoryModel allTrigger = new SpawnPointCategoryModel() { Parent = dbData,  Name = "Triggers" };
                //SpawnPointCategoryModel allLights = new SpawnPointCategoryModel() { Parent = dbData,  Name = "Lights" };
                //SpawnPointCategoryModel allSkies = new SpawnPointCategoryModel() { Parent = dbData,  Name = "Skies" };
                //SpawnPointCategoryModel allSounds = new SpawnPointCategoryModel() { Parent = dbData,  Name = "Sounds" };
                //StaticObjectCategoryModel DynamicObjects = new StaticObjectCategoryModel() { Parent = dbData, Name = "Dynamics" };

                //objects.Items.Add(allTrigger);
                //objects.Items.Add(allSpawns);
                //objects.Items.Add(allLights);
                //objects.Items.Add(allSkies);
                //objects.Items.Add(allSounds);
                //objects.Items.Add(DynamicObjects);



                dbData.Items.Add(objects);

                SceneCategoryModel scenes = new SceneCategoryModel()
                {
                    Parent = dbData, Name = "Scenes"
                };
                scenes.IsExpanded = true;
                dbData.Items.Add(scenes);


                mpm.Items.Add(dbData);
                dbData.IsExpanded = true;
            }
            else if (t.Name == "VEXSettings")
            {
                VEXSettings settings = new VEXSettings()
                {
                    Parent = mpm, Name = "VEXSettings"
                };

                mpm.Items.Add(settings);
                settings.IsExpanded = true;
            }
            else if (t.Name == "FileWatcherModel")
            {
                FileWatcherModel fileWatcher = new FileWatcherModel()
                {
                    Parent = mpm, Name = "FileWatcherModel", ContentID = "FileWatcherID:##:0"
                };

                mpm.Items.Add(fileWatcher);
                fileWatcher.IsExpanded = true;
            }
            //else if (t.Name == "VEX_RFS")
            //{
            //    mpm.AssetFolder = @"F:\Projekte\coop\VEX\data"; //todo set per propertygrid
            //    var assetBrowser = mpm.UnityContainer.Resolve<IAssetBrowserTreeService>();
            //    VEX_RFS fileAssets = new VEX_RFS() { Parent = mpm, UnityContainer = mpm.UnityContainer, Name = "Assets VFS", ContentID = "RootVFSID:##:" };
            //    fileAssets.Open(mpm.UnityContainer, mpm.AssetFolder);
            //    //        m_Items.Add(fileAssets);
            //    assetBrowser.SetAsRoot(fileAssets);

            //    mpm.Items.Add(new VEX_RFS() { Parent = mpm, UnityContainer = mpm.UnityContainer, Name = "RFS" });
            //}
        }