Ejemplo n.º 1
0
        private void ReadConfig()
        {
            var waypt = new Waypoint();

            if (VerifyDatabaseConnection())
            {
                SQL_search.RunQuery("db_Harbor", "SELECT * FROM [@profiles] WHERE COMPUTER ='" + Environment.MachineName + "'");
                if (SQL_search.RecordCount > 0)
                {
                    var dbId      = SQL_search.Ds.Tables[0].Rows[0]["ID"].ToString();
                    var dbVersion = SQL_search.Ds.Tables[0].Rows[0]["VERSION"].ToString();
                    MachineData.appLocation = SQL_search.Ds.Tables[0].Rows[0]["LOCATION"].ToString();
                    LoadApplication(SQL_search.Ds.Tables[0].Rows[0]["APPLICATION"].ToString());
                    //checks for recorded version number -------
                    if (MachineData.appVersion == dbVersion)
                    {
                        return;
                    }
                    //updates new version number -----------
                    SQL_general.UpdateComputer("db_Harbor", MachineData.appVersion, dbId);
                }
                else
                {
                    waypt.Show();
                }
            }
            else
            {
                waypt.Show();
            }
        }
Ejemplo n.º 2
0
        private void LoadApplication(string appName)
        {
            SQL_general.UpdatePoweredOn();
            switch (appName)
            {
            case "DockScheduleDisplay":
                var vm1   = new DockSchedule_VM();
                var page1 = new DockSchedule {
                    DataContext = vm1
                };
                Navigator.NavigationService = page1.NavigationFrame.NavigationService;
                page1.NavButtons.ShowPreview();
                page1.Show();
                break;

            case "DockScheduleTouch":
                var vm2   = new DockSchedule_VM();
                var page2 = new DockSchedule {
                    DataContext = vm2
                };
                Navigator.NavigationService = page2.NavigationFrame.NavigationService;
                page2.NavButtons.ShowInteractive();
                page2.Show();
                break;

            case "MachineOperations":
                var vm3   = new MachineOperations_VM();
                var page3 = new MachineOperations();
                Navigator.NavigationService = page3.NavigationFrame.NavigationService;
                page3.DataContext           = vm3;
                page3.Show();
                break;
            }
        }
Ejemplo n.º 3
0
        public static void LogError(string custom, string message, string stackTrace, string source, string targetSite)
        {
            var dateTime = DateTime.Now.ToString();
            var version  = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            SQL_general.InsertLog("db_Harbor", dateTime, Environment.MachineName, version, custom, message, stackTrace, source, targetSite);
        }
Ejemplo n.º 4
0
        private static async void ReadConfig(string versionNum)
        {
            var wayPoint = new Waypoint();

            Navigator.NavigationService = wayPoint.NavigationFrame.NavigationService;

            ResultSet rs = await SQL_search.RunQueryAsync("db_lighthouse", "SELECT * FROM [@profiles] WHERE COMPUTER ='" + Environment.MachineName + "'");

            if (rs?.recordCount > 0)
            {
                var dbVer = rs.dataSet.Tables[0].Rows[0]["VERSION"].ToString();
                UserSettings.uniqueId = rs.dataSet.Tables[0].Rows[0]["ID"].ToString();
                UserSettings.pcName   = rs.dataSet.Tables[0].Rows[0]["COMPUTER"].ToString();
                UserSettings.username = rs.dataSet.Tables[0].Rows[0]["USERNAME"].ToString();
                //UserSettings.version = rs.dataSet.Tables[0].Rows[0]["VERSION"].ToString();

                UserSettings.accounting = Convert.ToInt32(rs.dataSet.Tables[0].Rows[0]["ACCESS_ACCOUNTING"]) == 1 ? true : false;
                UserSettings.shipping   = Convert.ToInt32(rs.dataSet.Tables[0].Rows[0]["ACCESS_SHIPPING"]) == 1 ? true : false;
                UserSettings.infotech   = Convert.ToInt32(rs.dataSet.Tables[0].Rows[0]["ACCESS_INFOTECH"]) == 1 ? true : false;

                //checks for recorded version number -------
                if (UserSettings.version == dbVer)
                {
                    return;
                }
                //updates new version number -----------
                SQL_general.UpdateComputer("db_lighthouse", versionNum, UserSettings.uniqueId);
            }
            else
            {
                SQL_general.InsertComputer("db_lighthouse", Environment.MachineName, versionNum, versionNum);
            }

            wayPoint.Show();
        }
Ejemplo n.º 5
0
        private void Unlock_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (PswModuleUnlock.Password == password)
            {
                var column = "";
                switch (_vm.PageType)
                {
                case "Shipping":
                    column = "ACCESS_SHIPPING";
                    UserSettings.shipping = true;
                    break;

                case "Accounting":
                    column = "ACCESS_ACCOUNTING";
                    UserSettings.accounting = true;
                    break;

                case "Technology":
                    column = "ACCESS_INFOTECH";
                    UserSettings.infotech = true;
                    break;
                }

                SQL_general.UpdatePermission("db_lighthouse", column);
                _parent._vm.AccessSelectedPage(_vm.PageType);
            }
            PswModuleUnlock.Password = "";
        }
Ejemplo n.º 6
0
        public void UpdateConfig(string appName)
        {
            string notes = null;

            if (TxtMachineNotes.Text.Length > 0)
            {
                notes = TxtMachineNotes.Text;
            }
            MachineData.appLocation = CmbMachineLocation.Text;

            SQL_general.InsertComputer("db_Harbor", Environment.MachineName, MachineData.appLocation, TxtMachineNumber.Text, appName, notes, MachineData.appVersion);
        }
Ejemplo n.º 7
0
        public void clockDispatcherTimer_Tick(object sender, EventArgs e)
        {
            var now = DateTime.Now;

            if (now.Minute == 0 && now.Second == 0)
            {
                PrepareSilent();
            }
            if (now.Minute == 0 && now.Second == 30)
            {
                SQL_general.UpdatePoweredOn();
            }
        }