Beispiel #1
0
        public void CreateEntrys(string connection, string outputPath, string database)
        {
            TargetDir = outputPath;
            Manager   = new DbAccessLayer(DbAccessType.MsSql, connection);
            bool checkDatabase;

            try
            {
                checkDatabase = Manager.CheckDatabase();
            }
            catch (Exception)
            {
                checkDatabase = false;
            }

            if (!checkDatabase)
            {
                throw new Exception("Database not accessible. Maybe wrong Connection or no Selected Database?");
            }
            var databaseName = string.IsNullOrEmpty(Manager.Database.DatabaseName) ? database : Manager.Database.DatabaseName;

            if (string.IsNullOrEmpty(databaseName))
            {
                throw new Exception("Database not exists. Maybe wrong Connection or no Selected Database?");
            }
            WinConsole.WriteLine("Connection OK ... Reading Server Version ...");

            SqlVersion = Manager.RunSelect <string>(Manager.Database.CreateCommand("SELECT SERVERPROPERTY('productversion')")).FirstOrDefault();

            WinConsole.WriteLine("Server version is {0}", SqlVersion);

            WinConsole.WriteLine("Reading Tables from {0} ...", databaseName);

            Tables = Manager.Select <TableInformations>()
                     .ToArray()
                     .AsParallel()
                     .Select(s => new TableInfoModel(s, databaseName, new DbAccessLayer(DbAccessType.MsSql, connection)))
                     .ToList();

            Views = Manager.Select <ViewInformation>()
                    .ToArray()
                    .AsParallel()
                    .Select(s => new TableInfoModel(s, databaseName, new DbAccessLayer(DbAccessType.MsSql, connection)))
                    .ToList();

            StoredProcs = Manager.Select <StoredProcedureInformation>()
                          .Select(s => new StoredPrcInfoModel(s))
                          .ToList();

            WinConsole.WriteLine(
                "Found {0} Tables, {1} Views, {2} Procedures ... select a Table to see Options or start an Action", Tables.Count(),
                Views.Count(), StoredProcs.Count());
            Enums = new List <Dictionary <int, string> >();
            RenderMenu();
        }
Beispiel #2
0
 public void InsertView(int index, IMXView view)
 {
     if (index > Views.Count() - 1)
     {
         PushView(view);
     }
     else
     {
         _views.Insert(index, view);
     }
 }
Beispiel #3
0
        private void RenderMenu()
        {
            WinConsole.WriteLine("Tables:");
            var i = 0;

            for (; i < Tables.Count(); i++)
            {
                WinConsole.WriteLine("{0} \t {1}", i, Tables.ToArray()[i].Info.TableName);
            }

            WinConsole.WriteLine("Views:");
            var j = i;

            for (; j < Views.Count() + i; j++)
            {
                WinConsole.WriteLine("{0} \t {1}", j, Views.ToArray()[j - i].Info.TableName);
            }

            WinConsole.WriteLine("Procedures:");
            var k = j;

            for (; k < StoredProcs.Count() + j; k++)
            {
                WinConsole.WriteLine("{0} \t {1}", k, StoredProcs.ToArray()[k - j].Parameter.TableName);
            }

            WinConsole.WriteLine("Actions: ");

            WinConsole.WriteLine(@"[Name | Number]");
            WinConsole.WriteLine("		Edit table");
            WinConsole.WriteLine(@"\compile");
            WinConsole.WriteLine("		Starts the Compiling of all Tables");
            WinConsole.WriteLine(@"\ns");
            WinConsole.WriteLine("		Defines a default Namespace");
            WinConsole.WriteLine(@"\fkGen");
            WinConsole.WriteLine("		Generates ForgeinKeyDeclarations");
            WinConsole.WriteLine(@"\addConfigMethod");
            WinConsole.WriteLine("		Moves all attributes from Propertys and Methods into a single ConfigMethod");
            WinConsole.WriteLine(@"\withAutoCtor");
            WinConsole.WriteLine("		Generates Loader Constructors");
            WinConsole.WriteLine(@"\withNotification");
            WinConsole.WriteLine($"		Adds the '{nameof(INotifyPropertyChanged)}' interface to all Pocos");
            WinConsole.WriteLine(@"\autoGenNames");
            WinConsole.WriteLine("		Defines all names after a common naming convention");
            WinConsole.WriteLine(@"\addCompilerHeader	");
            WinConsole.WriteLine("		Adds a Timestamp and a created user on each POCO");
            WinConsole.WriteLine(@"\withValidators	");
            WinConsole.WriteLine("		Adds Validator attributes from the System.ComponentModel.DataAnnotations");
            WinConsole.WriteLine(@"\exit");
            WinConsole.WriteLine("		Stops the execution of the program");
            RenderMenuAction();
        }
Beispiel #4
0
            public void PushView(IMXView view)
            {
                var controller = TouchFactory.GetNativeObject <UIViewController>(view, "view");

                if (Views.Count() < 1)
                {
                    NavigationController.PushViewController(this, false);
                    NavigationController.PushViewController(controller, true);
                    controller.NavigationItem.HidesBackButton = false;
                }
                else
                {
                    NavigationController.PushViewController(controller, true);
                }
            }
Beispiel #5
0
        public override IMXView PopView()
        {
            if (Views.Count() < 2)
            {
                var views = CurrentView;

                if (PopoverWindow.IsVisible)
                {
                    PopoverWindow.Close();
                }

                return(views);
            }
            else
            {
                return(base.PopView());
            }
        }
Beispiel #6
0
        public void CreateEntrys(string connection, string outputPath, string database)
        {
            TargetDir = outputPath;
            bool checkDatabase = false;

            if (connection.StartsWith("file:\\\\"))
            {
                MsSqlStructure = new DacpacMsSqlStructure(connection.Replace("file:\\\\", ""));
                checkDatabase  = true;
            }
            else
            {
                var dbAccessLayer = new DbAccessLayer(DbAccessType.MsSql, connection);
                MsSqlStructure = new DatabaseMsSqlStructure(dbAccessLayer);
                try
                {
                    checkDatabase = dbAccessLayer.CheckDatabase();
                }
                catch (Exception)
                {
                    checkDatabase = false;
                }

                var databaseName = string.IsNullOrEmpty(dbAccessLayer.Database.DatabaseName) ? database : dbAccessLayer.Database.DatabaseName;
                if (string.IsNullOrEmpty(databaseName))
                {
                    throw new Exception("Database not exists. Maybe wrong Connection or no Selected Database?");
                }
            }


            if (!checkDatabase)
            {
                throw new Exception("Database not accessible. Maybe wrong Connection or no Selected Database?");
            }

            WinConsole.WriteLine("Connection OK ... Reading Server Version ...");

            SqlVersion = MsSqlStructure.GetVersion().ToString();

            WinConsole.WriteLine("Server version is {0}", SqlVersion);

            WinConsole.WriteLine("Reading Tables from {0} ...", MsSqlStructure.GetDatabaseName());

            Tables = MsSqlStructure.GetTables()
                     //.AsParallel()
                     .Select(s => new TableInfoModel(s, MsSqlStructure.GetDatabaseName(), MsSqlStructure))
                     .ToList();

            Views = MsSqlStructure.GetViews()
                    //.AsParallel()
                    .Select(s => new TableInfoModel(s, MsSqlStructure.GetDatabaseName(), MsSqlStructure))
                    .ToList();

            StoredProcs = MsSqlStructure.GetStoredProcedures()
                          .Select(s => new StoredPrcInfoModel(s))
                          .ToList();

            WinConsole.WriteLine(
                "Found {0} Tables, {1} Views, {2} Procedures ... select a Table to see Options or start an Action", Tables.Count(),
                Views.Count(), StoredProcs.Count());
            Enums = new List <Dictionary <int, string> >();
            RenderMenu();
        }