Exemplo n.º 1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            XmlSerializer serializer = new XmlSerializer(typeof(DBConfig));
            var conf = new DBConfig();
            using (var stream = File.OpenRead(@"d:\TK\Lesia\LabaBoiko\FizDb\ProjectsManager\FizDb.WebClient\bin\DBConfig.xml"))
            {
                conf = (DBConfig)serializer.Deserialize(stream);
            }
            var context = new RedContext() { Provider = new RedDBProvider(conf.ConnectionString) };
            Container.Context = context;
            Container.Dataset = GetDataSet(conf, context);
        }
Exemplo n.º 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            XmlSerializer serializer = new XmlSerializer(typeof(DBConfig));
            var           conf       = new DBConfig();

            using (var stream = File.OpenRead(@"d:\TK\Lesia\LabaBoiko\FizDb\ProjectsManager\FizDb.WebClient\bin\DBConfig.xml"))
            {
                conf = (DBConfig)serializer.Deserialize(stream);
            }
            var context = new RedContext()
            {
                Provider = new RedDBProvider(conf.ConnectionString)
            };

            Container.Context = context;
            Container.Dataset = GetDataSet(conf, context);
        }
Exemplo n.º 3
0
        private Red.RedDataSet GetDataSet(DBConfig config, RedContext context)
        {
            var dataSet = new RedDataSet();

            foreach (var t in config.Tables)
            {
                dataSet.AddTable(t.query, t.name, t.SearchQuery==null? null: t.SearchQuery.Query, context);
                if (t.Comboboxes != null)
                {
                    foreach (var c in t.Comboboxes)
                    {
                        dataSet.tables[t.name].AddComboBox(c.name, new RedComboBox(c.query, c.name));
                    }
                }
                if(t.Columns!=null)
                {
                    foreach (var c in t.Columns)
                    {
                        dataSet.tables[t.name].AddColumnAliasHere(c.Name, c.Alias);
                    }
                }
            }
            foreach (var r in config.Requests)
            {
               dataSet.AddView(r.query, r.name, r.desc, context);
               if (r.Comboboxes != null)
               {
                   foreach (var c in r.Comboboxes)
                   {
                       dataSet.views[r.name].AddComboBox(c.name, new RedComboBox(c.query, c.name));
                   }
               }
            }

            return dataSet;
        }
Exemplo n.º 4
0
        private Red.RedDataSet GetDataSet(DBConfig config, RedContext context)
        {
            var dataSet = new RedDataSet();

            foreach (var t in config.Tables)
            {
                dataSet.AddTable(t.query, t.name, t.SearchQuery == null? null: t.SearchQuery.Query, context);
                if (t.Comboboxes != null)
                {
                    foreach (var c in t.Comboboxes)
                    {
                        dataSet.tables[t.name].AddComboBox(c.name, new RedComboBox(c.query, c.name));
                    }
                }
                if (t.Columns != null)
                {
                    foreach (var c in t.Columns)
                    {
                        dataSet.tables[t.name].AddColumnAliasHere(c.Name, c.Alias);
                    }
                }
            }
            foreach (var r in config.Requests)
            {
                dataSet.AddView(r.query, r.name, r.desc, context);
                if (r.Comboboxes != null)
                {
                    foreach (var c in r.Comboboxes)
                    {
                        dataSet.views[r.name].AddComboBox(c.name, new RedComboBox(c.query, c.name));
                    }
                }
            }

            return(dataSet);
        }