예제 #1
0
        public KQuery Union <T>(string where)
        {
            MetaType metaType = MetaManager.GetMetaType(typeof(T));

            sql += String.Format(" union select * from {0} {1}", metaType.TableName, where);
            return(this);
        }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int    id         = Convert.ToInt32(Request["id"]);
        string name       = Request["name"];
        string title      = Request["title"];
        string desc       = Request["desc"];
        string iconurl    = Request["iconurl"];
        string grounpname = Request["grounpname"];
        string grounpcode = Request["grounpcode"];

        MetaManager mm = new MetaManager();

        editmetaa = mm.GetByID(id);
        //xet meta ko ton tai
        if (editmetaa.Id == 0)
        {
            Response.Write("Meta doesn't exist. Please try again.");
            return;
        }
        {
            editmetaa.Id          = id;
            editmetaa.Name        = name;
            editmetaa.Title       = title;
            editmetaa.Description = desc;
            editmetaa.IconURL     = iconurl;
            editmetaa.GroupCode   = grounpcode;
            editmetaa.GroupName   = grounpname;
            // luu  vao database
            mm.Save();
            Response.Write(1);
        }
    }
예제 #3
0
        public List <T> FindAll <T>()
        {
            MetaType metaType = MetaManager.GetMetaType(typeof(T));

            Command = new Command(String.Format("select * from {0}", metaType.TableName));
            return(List <T>());
        }
예제 #4
0
        private CodeAssembly _CheckCodeDistribution(MetaManager metaManager)
        {
            var distribution = CodeAssembly.None;

            foreach (var type in metaManager.MetaTypes)
            {
                var codeAssembly = type.GetCodeAssembly();
                distribution |= codeAssembly;
                if (distribution == CodeAssembly.All)
                {
                    break;
                }
            }

            if ((distribution & Metadata.CodeAssembly.StandardAssembly) != 0)
            {
                Directory.CreateDirectory(EditorMetaCommon.StandardAutoCodeDirectory);
            }

            if ((distribution & Metadata.CodeAssembly.ClientAssembly) != 0)
            {
                Directory.CreateDirectory(EditorMetaCommon.ClientAutoCodeDirectory);
            }

            if ((distribution & Metadata.CodeAssembly.EditorAssembly) != 0)
            {
                Directory.CreateDirectory(EditorMetaCommon.EditorAutoCodeDirectory);
            }

            return(distribution);
        }
예제 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int         id = Convert.ToInt32(Request["id"]);
        MetaManager mm = new MetaManager();

        editmeta = mm.GetByID(id);
    }
예제 #6
0
        public void TestAddCustomer()
        {
            MetaManager metaManager = new MetaManager();

            Customer customer = new Customer()
            {
                ID             = Guid.NewGuid().ToString(),
                Name           = "Customer01",
                Configurations = new Configuration[]
                {
                    new Configuration()
                    {
                        ID = Guid.NewGuid().ToString(),
                        ConfigurationType  = ConfigurationType.OEM,
                        DbConnectionString = "Data Source=.\\ADK;Initial Catalog=OEMKeyStore_009;User ID=DIS;Password=Chin@soft!"
                    },
                    new Configuration()
                    {
                        ID = Guid.NewGuid().ToString(),
                        ConfigurationType  = ConfigurationType.FactoryFloor,
                        DbConnectionString = "Data Source=.\\ADK;Initial Catalog=OEMKeyStore_008;User ID=DIS;Password=Chin@soft!"
                    },
                }
            };

            string result = metaManager.AddCustomerConfiguration(customer);

            Console.WriteLine(result);
        }
예제 #7
0
        private void AddCommand <T>(TextType textType, T entity)
        {
            Command   command = null;
            MetaTable table   = MetaManager.GetMetaTable(typeof(T));

            switch (textType)
            {
            case TextType.Insert:
                command = table.GetInsertCommand(Provider.ParamPrefix, entity);
                break;

            case TextType.Update:
                command = table.GetUpdateCommand(Provider.ParamPrefix, entity);
                break;

            case TextType.Delete:
                command = table.GetDeleteCommand(Provider.ParamPrefix, entity);
                break;
            }
            if (command != null)
            {
                if (Commands == null)
                {
                    Commands = new List <Command>();
                }
                Commands.Add(command);
            }
        }
예제 #8
0
        public void TestUpdateCustomer()
        {
            MetaManager metaManager = new MetaManager();

            Customer customer = new Customer()
            {
                ID             = "12a60e22-2960-4ac8-a3e3-dee806d6b990",
                Name           = "Customer001",
                Configurations = new Configuration[]
                {
                    new Configuration()
                    {
                        ID = "7ba30088-a526-4269-af9e-ba162bda3504",
                        ConfigurationType  = ConfigurationType.OEM,
                        DbConnectionString = "Data Source=.\\ADK;Initial Catalog=OEMKeyStore_007;User ID=DIS;Password=Chin@soft!"
                    },
                    new Configuration()
                    {
                        ID = Guid.NewGuid().ToString(),
                        ConfigurationType  = ConfigurationType.TPI,
                        DbConnectionString = "Data Source=.\\ADK;Initial Catalog=OEMKeyStore_009;User ID=DIS;Password=Chin@soft!"
                    }
                }
            };

            int result = metaManager.UpdateCustomerConfiguration(customer);

            Console.WriteLine(result);
        }
예제 #9
0
        public void MatchOperatorAssemblyFilenamePattern_InvalidInput_MatchFails()
        {
            var input = "SupplierAssembly_IDa0163af1-931f-4f37-9806-bb0a331db5cf_Version6b7f7727-1671-4a57-82a5-7dc104137c9c, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null";
            var match = MetaManager.MatchOperatorAssemblyFilenamePattern(input);

            Assert.IsFalse(match.Success);
        }
예제 #10
0
        public KQuery Select <T>(string where)
        {
            entityType = typeof(T);
            MetaType metaType = MetaManager.GetMetaType(entityType);

            sql = String.Format("select * from {0} {1}", metaType.TableName, where);
            return(this);
        }
예제 #11
0
        public void WriteAll(MetaManager metaManager)
        {
            _InitRootTypes(metaManager);
            _CheckCodeDistribution(metaManager);

            _WriteMetadataManager(metaManager);
            _WriteAllMetadataClasses(metaManager);
            _rootTypes.Clear();
        }
예제 #12
0
        public T Get <T>(string where)
        {
            MetaType metaType = MetaManager.GetMetaType(typeof(T));

            Command = new Command(
                String.Format("select * from {0} {1}", metaType.TableName, where)
                );
            return(Get <T>());
        }
예제 #13
0
        public object Scalar <T>(string propertyName, string where)
        {
            MetaType metaType = MetaManager.GetMetaType(typeof(T));

            Command = new Command(
                String.Format("select {0} from {1} {2}", propertyName, metaType.TableName, where)
                );
            return(Provider.QueryScalar(Command));
        }
예제 #14
0
    void Awake()
    {
                #if !UNITY_XBOXONE
        string words = "";
        using (StreamReader reader = new StreamReader(Application.dataPath + "/StreamingAssets/language.txt"))
        {
            words = reader.ReadLine();
            GameConstants.language = System.Convert.ToInt32(words);
        }
                #endif

        Random.seed = System.Environment.TickCount;
        Application.targetFrameRate = (int)GameConstants.TARGET_FRAMERATE;
        GameEventDistributor       += delegate(string arg1, object[] arg2) { Log("ManagerManager.cs: GAME EVENT: " + arg1); };

        Cursor.visible = false;
        gameObject.AddComponent <AudioListener>();

        //Debug.Log("setting up managers");
        mReferences = GetComponent <PrefabReferenceBehaviour>();
        //mMenuReferences = GetComponent<MenuReferenceBehaviour>();
        mNewRef = GetComponent <NewMenuReferenceBehaviour>();

        Manager = this;

        mCharacterBundleManager       = new CharacterBundleManager(this);
        mMusicManager                 = new MusicManager(this);
        mZigManager                   = new ZgManager(this);
        mProjectionManager            = new ProjectionManager(this);
        mBodyManager                  = new BodyManager(this);
        mTransparentBodyManager       = new BodyManager(this);
        mTransparentBodyManager.mMode = 1;         //nasty
        mBackgroundManager            = new BackgroundManager(this);
        mCameraManager                = new CameraManager(this);
        mAssetLoader                  = new AssetBundleLoader(this);
        mGameManager                  = new NewGameManager(this);
        mTransitionCameraManager      = new TransitionCameraManager(this);
        mMetaManager                  = new MetaManager(this);

        if (mStartDelegates != null)
        {
            /* CAN DELETE
             * var time = Time.time;
             * string output = "";
             * foreach(var e in mStartDelegates.GetInvocationList())
             * {
             *  e.DynamicInvoke();
             *  output += e.ToString() + " took: " + (Time.time - time) + "\n";
             *  time = Time.time;
             * }
             * Debug.Log(output);*/

            mStartDelegates();
        }

        ManagerManager.Log("ManagerManager.cs: AWAKE() COMPLETE");
    }
예제 #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var         id   = Convert.ToInt32(Request["id"]);
        MetaManager MM   = new MetaManager();
        MetaTBx     meta = MM.GetByID(id);

        meta.Status = -1;
        MM.Save();
        Response.Write(1);
    }
예제 #16
0
        private bool isDatabaseInUse(string dbConnectionString, out string databaseName, out string serverName, out Dictionary <string, string> suspectConfigurations)
        {
            if (this.metaManager == null)
            {
                this.metaManager = new MetaManager();
            }

            Customer[] customers = this.metaManager.ListCustomers(true);

            databaseName          = "";
            serverName            = "";
            suspectConfigurations = null;
            string userName = "", password = "", existingDBName = "", existingServerName = "";

            if ((customers != null) && (customers.Length > 0))
            {
                foreach (var cust in customers)
                {
                    foreach (var custConf in cust.Configurations)
                    {
                        if (custConf.DbConnectionString.ToLower() == dbConnectionString.ToLower())
                        {
                            DISConfigurationCloud.StorageManagement.DatabaseManager.ParseConnectionString(dbConnectionString, out serverName, out databaseName, out userName, out password);

                            return(true);
                        }
                        else
                        {
                            DISConfigurationCloud.StorageManagement.DatabaseManager.ParseConnectionString(dbConnectionString, out serverName, out databaseName, out userName, out password);

                            DISConfigurationCloud.StorageManagement.DatabaseManager.ParseConnectionString(custConf.DbConnectionString, out existingServerName, out existingDBName, out userName, out password);

                            if ((databaseName.ToLower() == existingDBName.ToLower()) && (serverName.ToLower() == existingServerName.ToLower()))
                            {
                                return(true);
                            }
                            else if (databaseName.ToLower() == existingDBName.ToLower())
                            {
                                if (suspectConfigurations == null)
                                {
                                    suspectConfigurations = new Dictionary <string, string>();
                                }

                                if (!suspectConfigurations.ContainsKey(cust.Name))
                                {
                                    suspectConfigurations.Add(cust.Name, existingServerName);
                                }
                            }
                        }
                    }
                }
            }

            return(false);
        }
예제 #17
0
        public static void Make()
        {
            var metaManager = new MetaManager();

            new AutoCodeMaker().WriteAll(metaManager);

            _RemoveEmptyFiles(EditorMetaCommon.StandardAutoCodeDirectory);
            _RemoveEmptyFiles(EditorMetaCommon.ClientAutoCodeDirectory);
            _RemoveEmptyFiles(EditorMetaCommon.EditorAutoCodeDirectory);
            AssetDatabase.Refresh();
        }
예제 #18
0
 private void _InitRootTypes(MetaManager metaManager)
 {
     foreach (var type in metaManager.MetaTypes)
     {
         var rootType = EditorMetaCommon.GetRootMetadata(type.RawType);
         if (type.RawType != rootType)
         {
             _rootTypes.Add(rootType);
         }
     }
 }
예제 #19
0
        private void getData(string customerID)
        {
            if (this.metaManager == null)
            {
                this.metaManager = new MetaManager();
            }

            Customer customer = this.metaManager.GetCustomer(customerID);

            this.customers = new List <Customer>(new Customer[] { customer });
        }
예제 #20
0
        public async Task AddListRemove_HappyPath_Ok()
        {
            await using var context = GetTest1Context();

            using var test = new TestFS(Test4ArchiveUrl, BaseTestFolder);

            var settings = JsonConvert.DeserializeObject <AppSettings>(_settingsJson);

            settings.DatasetsPath = Path.Combine(test.TestFolder, DdbFolder);
            _appSettingsMock.Setup(o => o.Value).Returns(settings);
            _authManagerMock.Setup(o => o.IsUserAdmin()).Returns(Task.FromResult(true));
            _authManagerMock.Setup(o => o.IsOwnerOrAdmin(It.IsAny <Dataset>())).Returns(Task.FromResult(true));

            var ddbManager = new DdbManager(_appSettingsMock.Object, _ddbFactoryLogger);

            var webUtils = new WebUtils(_authManagerMock.Object, context, _appSettingsMock.Object,
                                        _httpContextAccessorMock.Object, ddbManager);

            var metaManager = new MetaManager(_metaManagerLogger, ddbManager, _authManagerMock.Object, webUtils);

            var a = await metaManager.Add(MagicStrings.PublicOrganizationSlug, MagicStrings.DefaultDatasetSlug,
                                          "annotations", "{\"test\":123}");

            a.Data["test"].ToObject <int>().Should().Be(123);

            var res = await metaManager.List(MagicStrings.PublicOrganizationSlug, MagicStrings.DefaultDatasetSlug);

            res.Should().HaveCount(1);
            res.First().Count.Should().Be(1);
            res.First().Key.Should().Be("annotations");

            var a2 = await metaManager.Add(MagicStrings.PublicOrganizationSlug, MagicStrings.DefaultDatasetSlug, "annotations",
                                           "{\"test\":4124,\"pippo\":\"ciao\"}");

            a2.Data["test"].ToObject <int>().Should().Be(4124);
            a2.Data["pippo"].ToObject <string>().Should().Be("ciao");

            (await metaManager.List(MagicStrings.PublicOrganizationSlug, MagicStrings.DefaultDatasetSlug)).Should().HaveCount(1);

            (await metaManager.Get(MagicStrings.PublicOrganizationSlug, MagicStrings.DefaultDatasetSlug, "annotations"))
            .Should().HaveCount(2);

            (await metaManager.Remove(MagicStrings.PublicOrganizationSlug, MagicStrings.DefaultDatasetSlug, a.Id)).Should().Be(1);

            (await metaManager.Get(MagicStrings.PublicOrganizationSlug, MagicStrings.DefaultDatasetSlug, "annotations"))
            .Should().HaveCount(1);

            (await metaManager.Unset(MagicStrings.PublicOrganizationSlug, MagicStrings.DefaultDatasetSlug, "annotations")).Should().Be(1);

            (await metaManager.List(MagicStrings.PublicOrganizationSlug, MagicStrings.DefaultDatasetSlug)).Should()
            .BeEmpty();
        }
예제 #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SliderManager SM = new SliderManager();

        listSlider = SM.GetList();
        PageManager PM = new PageManager();

        pageAbout   = PM.GetByName("about-us");
        pageService = PM.GetByName("home-service");
        MetaManager mm = new MetaManager();

        listMeta = mm.GetList();
    }
예제 #22
0
        private Command GetCommand <T>(params object[] id)
        {
            MetaTable table = MetaManager.GetMetaTable(typeof(T));

            return(new Command(
                       String.Format(
                           "SELECT * FROM {0} WHERE {1}",
                           table.RowType.TableName,
                           table.GetKeyFieldString(Provider.ParamPrefix)
                           ),
                       table.GetKeyParameters(Provider.ParamPrefix, id)
                       ));
        }
예제 #23
0
        public int Count <T>(string where)
        {
            MetaType metaType = MetaManager.GetMetaType(typeof(T));

            Command = new Command(
                String.Format("select count(*) from {0} {1}", metaType.TableName, where)
                );
            object result = Provider.QueryScalar(Command);
            int    count  = 0;

            int.TryParse(result.ToString(), out count);
            return(count);
        }
예제 #24
0
        private void SetEntity <T>(T entity, IDataReader reader)
        {
            Type type = typeof(T);

            foreach (MetaParameter param in MetaManager.GetMetaParameters(type))
            {
                object value = reader[param.MappedName];
                if (value == DBNull.Value)
                {
                    value = String.Empty;
                }
                type.GetProperty(param.PropertyName).SetValue(entity, value, null);
            }
        }
예제 #25
0
        public async Task <Package[]> GetInstalledPackages()
        {
            var installedPackages = new Dictionary <string, Package>();

            foreach (string projFilePath in ProjectFiles)
            {
                var project = Project.Load(projFilePath);
                AddPackages(project, installedPackages);
            }

            SetPackageConflicts(installedPackages);

            await MetaManager.SetPackageMeta(installedPackages.Values);

            return(installedPackages.Values.OrderBy(p => p.Name).ToArray());
        }
예제 #26
0
        public ActionResult GetIssueRow(int issueId)
        {
            var issue = IssueManager.Get(issueId);

            ItemsGridModel model = new ItemsGridModel();

            var visibility = GetChangelogFields(issue.Entity.ProjectId);

            List <int> projectIds = new List <int>();

            projectIds.Add(issue.Entity.ProjectId);

            var properties = GridManager.GetDisplayProperties(MetaManager.TypeGetAll(new List <ProjectDto>()
            {
                UserContext.Project
            }), visibility, projectIds);

            model.AllowSequencing = false;

            model.ShowSequencing = false;

            model.GroupDependencies = false;

            model.Issues.Add(issue);

            model.Columns = GridManager.DescribeGridColumns(properties);

            model.DisplayData = GridManager.GetDisplayData(model.Issues, model.Columns);

            model.Options = GridManager.DescribeGridOptions();

            JsonResponse response = new JsonResponse();

            response.Success = true;

            response.Result = new
            {
                Html = RenderPartialViewToString(this, "~/Views/Shared/DisplayTemplates/IssueDtoRow.cshtml", model),
            };

            string data = response.ToJson().Replace("<", "\\u003c").Replace(">", "\\u003e").Replace("&", "\\u0026");

            return(Content(data, Request.Files.Count == 0 ? "application/json" : "text/html"));
        }
예제 #27
0
    protected void Page_Load(object sender, EventArgs e)

    {
        try {
            int id = Convert.ToInt32(Request["id"]);

            string name      = Request["name"];
            string title     = Request["title"];
            string desc      = Request["desc"];
            string groupname = Request["groupname"];
            string groupcode = Request["groupcode"];

            MetaManager mm = new MetaManager();
            editmetaa             = mm.GetByID(id);
            editmetaa.Name        = name;
            editmetaa.Title       = title;
            editmetaa.Description = desc;
            editmetaa.GroupCode   = groupcode;
            editmetaa.GroupName   = groupname;
            string base64 = Request["base64"];
            mm.Save();
            if (!string.IsNullOrEmpty(base64))
            {
                byte[]       imageBytes = Convert.FromBase64String(base64);
                MemoryStream ms         = new MemoryStream(imageBytes, 0, imageBytes.Length);
                ms.Write(imageBytes, 0, imageBytes.Length);
                System.Drawing.Image image = System.Drawing.Image.FromStream(ms, true);
                image.Save(Server.MapPath("~/upload/imagemeta/editimage_" + editmetaa.Id + ".jpg"));
            }

            Response.Write(JsonConvert.SerializeObject(new
            {
                success = 1
            }));
        }
        catch (Exception ex)
        {
            Response.Write(JsonConvert.SerializeObject(new
            {
                success = -1,
                error   = ex
            }));
        }
    }
예제 #28
0
        public void TestListCustomers()
        {
            MetaManager metaManager = new MetaManager();

            Customer[] customers = metaManager.ListCustomers();

            System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(Customer[]), new Type[] { typeof(Customer), typeof(Configuration), typeof(ConfigurationType), typeof(Configuration[]) });

            string result = "-9";

            using (System.IO.StringWriter writer = new System.IO.StringWriter())
            {
                serializer.Serialize(writer, customers);

                result = writer.ToString();
            }

            Console.WriteLine(result);
        }
예제 #29
0
        public static NougatCli Create(string projectDir, ILoggerFactory loggerFactory,
                                       string searchUrl = null)
        {
            searchUrl = searchUrl ?? DefaultSearchUrl;

            var metaMgr = MetaManager.Create(loggerFactory, searchUrl);

            return(new NougatCli {
                // Locations:
                ProjectDir = projectDir,
                SearchUrl = searchUrl,

                // Individual Managers:
                MetaMgr = metaMgr,
                ProjectMgr = ProjectManager.Create(loggerFactory, metaMgr, projectDir),
                UpdateMgr = UpdateManager.Create(loggerFactory),
                DisplayMgr = DisplayManager.Create(Console.Out)
            });
        }
예제 #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try

        {
            string      name      = Request["name"];
            string      title     = Request["title"];
            string      desc      = Request["desc"];
            string      groupname = Request["groupname"];
            string      groupcode = Request["groupcode"];
            MetaManager MM        = new MetaManager();
            MetaTBx     meta      = new MetaTBx();
            meta.Title       = title;
            meta.Description = desc;
            meta.GroupCode   = groupcode;
            meta.GroupName   = groupname;
            meta.Name        = name;
            meta.Status      = 1;
            MM.AddNew(meta);
            meta.IconURL = "/upload/imagemeta/image_" + meta.Id + ".jpg";
            MM.Save();
            string       base64     = Request["base64"];
            byte[]       imageBytes = Convert.FromBase64String(base64);
            MemoryStream ms         = new MemoryStream(imageBytes, 0, imageBytes.Length);
            ms.Write(imageBytes, 0, imageBytes.Length);
            System.Drawing.Image image = System.Drawing.Image.FromStream(ms, true);

            image.Save(Server.MapPath("~/upload/imagemeta/image_" + meta.Id + ".jpg"));
            Response.Write(JsonConvert.SerializeObject(new
            {
                success = 1
            }));
        }
        catch (Exception ex)
        {
            Response.Write(JsonConvert.SerializeObject(new
            {
                success = -1,
                error   = ex
            }));
        }
    }