Exemplo n.º 1
0
        /// <summary>
        /// Grava Parâmetro
        /// </summary>
        /// <param name="efconfig"></param>
        /// <param name="databaseCommandCommit"></param>
        /// <returns></returns>
        public bool GravarParametro(EFConfig efconfig, IDatabaseCommandCommit databaseCommandCommit)
        {
            if (efconfig == null)
            {
                throw new ArgumentException("Dados Inválidos!");
            }

            if (string.IsNullOrEmpty(efconfig.Value))
            {
                throw new ArgumentException("Valor do parâmetro não informado!");
            }

            if (efconfig.EFAccountID == 0)
            {
                throw new ArgumentException("Código do parâmetro inválido!");
            }

            if (efconfig.Active != "S" && efconfig.Active != "N")
            {
                throw new ArgumentException("Informe se o parâmetro está ativo ou inativo!");
            }

            if (string.IsNullOrEmpty(efconfig.UpdtUserCode))
            {
                throw new ArgumentException("Usuário não informado!");
            }

            return(parametroAplicacaoRepository.GravarParametro(efconfig, databaseCommandCommit));
        }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            // show Trello info if setup
            if (Config == null || !Config.objectReferenceValue)
            {
                EditorGUILayout.LabelField("Easy Feedback is not yet configured!");
                if (GUILayout.Button("Configure Now"))
                {
                    ConfigWindow.Init();
                }
            }
            else
            {
                EFConfig config = Config.objectReferenceValue as EFConfig;
                if (string.IsNullOrEmpty(config.Token))
                {
                    EditorGUILayout.LabelField("Not authenticated with Trello!");
                    if (GUILayout.Button("Authenticate Now"))
                    {
                        ConfigWindow.Init();
                    }
                }
            }

            base.OnInspectorGUI();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Attempts to load the TrelloInfo asset from the EasyFeedback directory
 /// </summary>
 /// <returns></returns>
 private void loadConfigAsset()
 {
     config = AssetDatabase.LoadAssetAtPath <EFConfig>(CONFIG_ASSET_LOCATION);
     if (!config) // no config file yet, create one
     {
         createConfigAsset();
     }
 }
Exemplo n.º 4
0
        protected void Application_Start()
        {
            var config = GlobalConfiguration.Configuration;

            RouteConfig.RegisterRoutes(config);
            WepApiConfig.Configure(config);
            AutofacWebAPI.Initialize(config);
            EFConfig.Initialize();
        }
Exemplo n.º 5
0
        public EFConfig GetConfig(EFConfig efconfig)
        {
            if (efconfig == null)
            {
                throw new ArgumentException("Dados Inválidos!");
            }

            return(parametroAplicacaoRepository.GetConfig(efconfig));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Obtem os parâmetros da aplicação de acordo com o filtro aplicado
        /// </summary>
        /// <param name="filtro"></param>
        /// <returns></returns>
        public ICollection <EFConfig> GetParametros(EFConfig filtro)
        {
            if (filtro == null)
            {
                throw new ArgumentException("Dados Inválidos!");
            }

            return(parametroAplicacaoRepository.GetParametros(filtro));
        }
Exemplo n.º 7
0
 private void OnEnable()
 {
     if (trello == null)
     {
         // init trello API handler
         EFConfig config = AssetDatabase.LoadAssetAtPath <EFConfig>(ConfigWindow.CONFIG_ASSET_LOCATION);
         trello = new Trello(config.Token);
     }
 }
Exemplo n.º 8
0
        public EFConfig GetConfig(EFConfig efconfig)
        {
            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@veExecutor", 1));
            parameters.Add(new SqlParameter("@veParametro", 2));
            parameters.Add(new SqlParameter("@veEFConfigID", efconfig.EFConfigID));

            return(this.databaseQueryCommand.GetEntity <EFConfig>(this.Procedure, parameters));
        }
Exemplo n.º 9
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            EFConfig.Initialize();
        }
Exemplo n.º 10
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     // Dependency Injection configuration
     DIConfig.RegisterContainer();
     // Entity Framework initialization (passing database connection string)
     EFConfig.RegisterDatabase(ConfigurationManager.ConnectionStrings["LogerDBConnectionString"].ConnectionString);
 }
Exemplo n.º 11
0
        public void Configuration(IAppBuilder appBuilder)
        {
            // Configure Web API for self-host.
            HttpConfiguration config = new HttpConfiguration();

            AutofacConfig.Initialize(config);
            RouteConfig.RegisterRoutes(config);
            ApiConfig.Setup(config);
            EFConfig.Initialize();

            appBuilder.UseWebApi(config);
        }
Exemplo n.º 12
0
        protected void Application_Start(object sender, EventArgs e)
        {
            GlobalConfiguration.Configure(WebAPIConfig.Register);

            var config = GlobalConfiguration.Configuration;

            //var cors = new EnableCorsAttribute(origins: "http://localhost:4200", headers: "*", methods: "*");
            //config.EnableCors(cors);
            RouteConfig.RegisterRoutes(config);
            WebAPIConfig.Configure(config);
            AutofacConfig.Initialize(config);
            EFConfig.Initialize();
        }
Exemplo n.º 13
0
        /// <summary>
        /// Grava Parâmetro
        /// </summary>
        /// <param name="efconfig"></param>
        /// <param name="databaseCommandCommit"></param>
        /// <returns></returns>
        public bool GravarParametro(EFConfig efconfig, IDatabaseCommandCommit databaseCommandCommit)
        {
            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@veExecutor", 2));
            parameters.Add(new SqlParameter("@veParametro", 1));
            parameters.Add(new SqlParameter("@veEFConfigID", efconfig.EFConfigID));
            parameters.Add(new SqlParameter("@veActive", efconfig.Active));
            parameters.Add(new SqlParameter("@veValue", efconfig.Value));
            parameters.Add(new SqlParameter("@veUpdtUserCode", efconfig.UpdtUserCode));

            return(databaseCommandCommit.Update(Procedure, parameters) > 0);
        }
Exemplo n.º 14
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            UnityConfig.RegisterComponents();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            GlobalFilters.Filters.Add(new AuthorizeAttribute());
            //GlobalFilters.Filters.Add(new ForumAuthorizeAttribute());

            EFConfig.Initialize();
            UnityConfig.Container.Resolve <IDataSeedService>().SeedData();
        }
Exemplo n.º 15
0
        /// <summary>
        /// Obtem os parâmetros da aplicação de acordo com o filtro aplicado
        /// </summary>
        /// <param name="filtro"></param>
        /// <returns></returns>
        public ICollection <EFConfig> GetParametros(EFConfig filtro)
        {
            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@veExecutor", 1));
            parameters.Add(new SqlParameter("@veParametro", 1));

            if (!string.IsNullOrEmpty(filtro.Description))
            {
                parameters.Add(new SqlParameter("@veDescription", filtro.Description));
            }

            return(this.databaseQueryCommand.Select <EFConfig>(this.Procedure, parameters));
        }
Exemplo n.º 16
0
        public void createConfigAsset()
        {
            // create the config asset
            config = new EFConfig();
            AssetDatabase.CreateAsset(config, CONFIG_ASSET_LOCATION);
            EditorUtility.SetDirty(config);
            AssetDatabase.SaveAssets();

            // update Feedback prefab
            GameObject feedbackPrefab = AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Easy Feedback/Feedback.prefab");

            feedbackPrefab.GetComponent <FeedbackForm>().Config = config;
            EditorUtility.SetDirty(feedbackPrefab);
            AssetDatabase.SaveAssets();
        }
Exemplo n.º 17
0
        /// <summary>
        /// 使用EF持久化
        /// </summary>
        /// <param name="services"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static IServiceCollection AddEf(this IServiceCollection services, Action <EFConfig> configure)
        {
            var options = new EFConfig();

            //装饰
            configure?.Invoke(options);
            //优先级控制
            ObjectMapper.MapperTo(options, ConfigFileHelper.Get <EFConfig>());
            //ef相关配置
            services.AddSingleton(options);
            //注册通用DbContext上下文,主要为通用的EFRepository仓储提供数据对象,单个数据上下文时不需要定义自己的仓储
            services.AddTransient(typeof(DbContext), options.DbContextType);
            //注册通用数据仓储
            services.AddTransient(typeof(IRepository <>), typeof(EFRepository <>));
            //注册当前数据上下文,主要为当前业务仓储提交数据对象,而业务仓储的注册在业务项目里,实例模式
            services.AddTransient(options.DbContextType);
            return(services);
        }
Exemplo n.º 18
0
        protected void Application_Start()
        {
            EFConfig.Initialize();

            AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            //DependencyResolver.SetResolver(new StructureMapDependencyResolver(()=> Container ?? ObjectFactory.Container));



            //ObjectFactory.Configure(cfg =>
            //{

            //    cfg.AddRegistry(new StandardRegistry());
            //    cfg.AddRegistry(new ControllerRegistry());
            //    cfg.AddRegistry(new ActionFilterRegistry(
            //        () => Container ?? ObjectFactory.Container));
            //    cfg.AddRegistry(new MvcRegistry());
            //});
        }
Exemplo n.º 19
0
        internal void InitEntitys <T>(string curVer) where T : new()
        {
            T    classInstance = new T();
            Type type          = typeof(T);
            //获取表名
            string tableName = Tool.GetTableName(type);

            if (tableName == null)
            {
                return;
            }

            bool      forceUpdateTable = false;
            FieldInfo tmp = type.GetField("ForceUpdateTable");

            if (tmp != null)
            {
                forceUpdateTable = (bool)tmp.GetValue(classInstance);
            }

            bool clearData = false;

            tmp = null;
            tmp = type.GetField("ClearData");
            if (tmp != null)
            {
                clearData = (bool)tmp.GetValue(classInstance);
            }

            string defaultJsonData = null;

            tmp = null;
            tmp = type.GetField("DefaultJsonData");
            if (tmp != null)
            {
                defaultJsonData = (string)tmp.GetValue(classInstance);
            }

            //判断表是否存在
            bool tableExists = _dbHelper.TableExists(tableName);

            if (!tableExists)
            {   //表不存在创建表
                tableExists = CreateTable <T>();
            }
            if (tableExists)
            {
                string oldVer = "";

                DataTable efconfig = _dbHelper.QueryTable("select * from efconfig;");
                if (efconfig != null)
                {
                    DataRow[] rows = efconfig.Select($"key='{tableName}'");
                    if (rows.Length > 0)
                    {
                        oldVer = rows[0].GetDataRowStringValue("value");
                    }
                }

                if (oldVer != curVer)
                {
                    AlterTable <T>(forceUpdateTable);

                    if (clearData)
                    {
                        DeleteData <T>(null, null);
                    }

                    if (!string.IsNullOrWhiteSpace(defaultJsonData))
                    {
                        T[] datas = JsonConvert.DeserializeObject <T[]>(defaultJsonData);
                        InsertOrUpdate <T>(null, datas);
                    }

                    EFConfig ver = new EFConfig()
                    {
                        key = tableName, value = curVer, uptime = DateTime.Now
                    };
                    InsertOrUpdate <EFConfig>("key", ver);
                }
            }
        }