Esempio n. 1
0
        public static void Build(Database _dbObject)
        {
            //------------------------------------------------------
            _NameSpace = Globals.GetProgramatlyName(_dbObject.Name);
            //------------------------------------------------------
            _ProjectFolder = AppDomain.CurrentDomain.BaseDirectory + _NameSpace;
            if (Directory.Exists(_ProjectFolder))
            {
                Directory.Delete(_ProjectFolder, true);
            }
            Directory.CreateDirectory(_ProjectFolder);
            Directory.CreateDirectory(_ProjectFolder + @"\db\");
            Directory.CreateDirectory(_ProjectFolder + @"\Controllers\");
            Directory.CreateDirectory(_ProjectFolder + @"\Models\");
            Directory.CreateDirectory(_ProjectFolder + @"\Views\");
            //------------------------------------------------------
            db = new CustomDatabase(_dbObject);
            foreach (CustomTable table in db.Tables)
            {
                StoredProcedureBuilder.Create(table);
                Directory.CreateDirectory(_ProjectFolder + @"\Models\" + table.ProgramatlyName);

                SqlProviderBuilder.Create(table);
                FactoryBuilder.Create(table);
                ModelBuilder.Create(table);
                ControllerBuilder.Create(table);

                Directory.CreateDirectory(_ProjectFolder + @"\Views\" + table.ProgramatlyName);
                IndexViewBuilder.Create(table);
                DialogBoxViewBuilder.Create(table);
            }
            Directory.CreateDirectory(_ProjectFolder + @"\Views\Shared\");
            Directory.CreateDirectory(_ProjectFolder + @"\Views\Home\");
            NavigationLinksBuilder.Create(db);
        }
        //------------------------------------------------------------------------------------------------------
        #endregion

        public static void Create(CustomTable t)
        {
            StoredProcedureBuilder sp = new StoredProcedureBuilder(t);
            string proc = sp.GenerateInsertProcedure();

            WriteStoredProcedure(proc);
            proc += sp.GenerateUpdatePrcedure();
            proc += sp.GenerateDeletePrcedure();
            proc += sp.GenerateGet();
            if (sp.CurrentTable.ID != null)
            {
                proc += sp.GenerateGetPageByPage();
            }
            FileManager.SaveFile(".Sql", sp.CurrentTable.PathOfStoredProcerduresFile, proc);
            //WriteStoredProcedure(proc);
        }
        public static void Build(Database _dbObject)
        {
            //------------------------------------------------------
            _NameSpace = Globals.GetProgramatlyName(_dbObject.Name);
            //------------------------------------------------------
            _ProjectFolder = AppDomain.CurrentDomain.BaseDirectory + _NameSpace;
            if (Directory.Exists(_ProjectFolder))
            {
                Directory.Delete(_ProjectFolder, true);
            }
            Directory.CreateDirectory(_ProjectFolder);
            Directory.CreateDirectory(_ProjectFolder + @"\db\");
            Directory.CreateDirectory(_ProjectFolder + @"\Controllers\");
            Directory.CreateDirectory(_ProjectFolder + @"\Models\");
            Directory.CreateDirectory(_ProjectFolder + @"\Services\");
            Directory.CreateDirectory(_ProjectFolder + @"\Repositories\");
            Directory.CreateDirectory(_ProjectFolder + @"\Views\");
            //------------------------------------------------------
            db = new CustomDatabase(_dbObject);

            foreach (CustomTable table in db.Tables)
            {
                DtoBuilder.Create(table);//first one because it reads additional meta data and set them into custom table object
                ModelBuilder.Create(table);
                StoredProcedureBuilder.Create(table);
                Directory.CreateDirectory(_ProjectFolder + @"\Models\" + table.ProgramatlyName);
                RepositoryBuilder.Create(table);
                ApplicationServiceBuilder.Create(table);
                ControllerBuilder.Create(table);
                Directory.CreateDirectory(_ProjectFolder + @"\Views\" + table.ProgramatlyName);
                IndexViewBuilder.Create(table);
                DialogBoxViewBuilder.Create(table);
            }
            Directory.CreateDirectory(_ProjectFolder + @"\Views\Shared\");
            Directory.CreateDirectory(_ProjectFolder + @"\Views\Home\");
            NavigationLinksBuilder.Create(db);
        }