Exemplo 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();
            }
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        private void CalculateAverage()
        {
            var baseDate     = DateTime.Now;
            var span         = new DateTime();
            var fwd          = baseDate.AddDays(-(int)baseDate.DayOfWeek);
            var lwd          = fwd.AddDays(7).AddSeconds(-1);
            var firstWeekday = fwd.ToString("MM/dd/yyyy");
            var lastWeekDay  = lwd.ToString("MM/dd/yyyy");

            SQL_search.RunQuery("db_Harbor", "SELECT IN_TIME, OUT_TIME FROM DS_SCHEDULE WHERE SCHEDULE_TIME BETWEEN '" +
                                firstWeekday + " 00:00:00.00' AND '" + lastWeekDay + " 23:59:59.999' AND LOAD_TIME > '00:05:00' AND LOCATION = '" + MachineData.appLocation + "'");

            if (SQL_search.RecordCount > 0)
            {
                for (var i = 0; i < SQL_search.RecordCount; i++)
                {
                    var inTime  = DateTime.Parse(SQL_search.Ds.Tables[0].Rows[i]["IN_TIME"].ToString(), new CultureInfo("en-US", true));
                    var outTime = DateTime.Parse(SQL_search.Ds.Tables[0].Rows[i]["OUT_TIME"].ToString(), new CultureInfo("en-US", true));
                    span += outTime - inTime;
                }
                var avgSpan = new TimeSpan(span.Ticks / SQL_search.RecordCount);
                HeaderAverage = DateTime.MinValue.Add(avgSpan).ToString("H:mm:ss");
            }
            else
            {
                HeaderAverage = "00:00:00";
            }
        }
Exemplo n.º 4
0
        public static string Get_FileUrl(string part, string container)
        {
            SQL_search.RunQuery("db_Harbor", "SELECT * FROM MO_FILE_LISTING WHERE PART = '" + part + "' AND CONTAINER = '" + container + "'");
            if (SQL_search.RecordCount <= 0)
            {
                return(null);
            }
            var url = SQL_search.Ds.Tables[0].Rows[0]["MASTER"].ToString();

            return(url.Contains(".pdf") ? CreateTempFile(url, ".pdf") : CreateTempFile(url + ".pdf", ".pdf"));
        }
Exemplo n.º 5
0
        public static string Get_BoMsUrl(string part)
        {
            const string location = "S:/Information Systems/@Developer Resources/Applications/Harbor/Bill of Material.rpt";

            if (!File.Exists(location))
            {
                return(null);
            }
            SQL_search.RunQuery("db_Harbor", "EXEC Bill_of_Materials '" + part + "'");

            return(SQL_search.RecordCount > 0 ? CreateTempFile(location, ".rpt") : null);
        }
Exemplo n.º 6
0
        public void LoadRecords()
        {
            SQL_search.RunQuery("db_lighthouse", $"SELECT TOP {MAX_ENTRIES} * FROM SUMMARY_REMITS ORDER BY ID DESC");
            recordsFound = SQL_search.RecordCount;

            if (recordsFound <= 0)
            {
                return;
            }
            for (var i = 0; i < recordsFound; i++)
            {
                var dr = SQL_search.Ds.Tables[0].Rows[i];
                RecordRow(dr);
            }
        }
Exemplo n.º 7
0
        public DockSchedule()
        {
            InitializeComponent();

            if (SQL_search.HasConnection("db_Harbor"))
            {
                //TODO CONTINUE PAGE LOAD
            }
            else
            {
                //TODO SHOW DB ERROR
                //TODO HOW TO USE IN PAGE ON REFRESH
                //TODO MAYBE MOVE TO HEADER
            }
        }
Exemplo n.º 8
0
        public MachineOperations_VM()
        {
            if (!SQL_search.HasConnection("db_Harbor"))
            {
                return;
            }
            SQL_search.RunQuery("db_Harbor", "SELECT * FROM [@profiles] WHERE COMPUTER = '" + Environment.MachineName + "'");

            if (SQL_search.RecordCount <= 0)
            {
                return;
            }
            //MachineData.Number = SQL_search.Ds.Tables[0].Rows[0]["NUMBER"].ToString();
            MachineData.Number = SQL_search.Ds.Tables[0].Rows[0]["ID"].ToString();
        }
Exemplo n.º 9
0
        private void DockLocationArray()
        {
            SQL_search.RunQuery("db_Sandbar", "SELECT * FROM DS_CAT_LOCATIONS WHERE LOCATION = '" + MachineData.appLocation + "'");

            if (SQL_search.RecordCount <= 0)
            {
                return;
            }
            AddDockToList.Clear();
            var dockMax = Convert.ToInt32(SQL_search.Ds.Tables[0].Rows[0]["DOCK"]);

            for (var i = 1; i <= dockMax; i++)
            {
                AddDockToList.Add(i.ToString());
            }
        }
Exemplo n.º 10
0
        //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        //''''''''''''''''''''''''''''''''''''           PANEL BUTTONS           ''''''''''''''''''''''''''''''''''''
        //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        public void Action_UpdateRow(object sender, EventArgs e)
        {
            DSInteractiveEntry     dsie = sender as DSInteractiveEntry;
            DSInteractiveEntryData data = dsie.DataContext as DSInteractiveEntryData;
            string id = data.PairId;

            var now = DateTime.Now;

            if (data.Action == DSInteractiveEntryData.MARK_ARRIVED)
            {
                //LATE ARRIVAL HIGHLIGHT-------------------------
                SQL_search.RunQuery("db_Sandbar", $"SELECT * FROM DS_entries WHERE ID = {id}");

                var scheduleTime = SQL_search.Ds.Tables[0].Rows[0]["SCHEDULE_TIME"].ToString();
                var displayTime  = DateTime.Parse(scheduleTime, new CultureInfo("en-US", true));

                if (DateTime.Now > displayTime)
                {
                    data.MarkLate();
                }
                //-----------------------------------------------

                data.Action       = DSInteractiveEntryData.SENT_TO_DOCK;
                data.ArrivedValue = now.ToShortTimeString();

                SQL_dockSchedule.InsertTime("ARRIVAL_TIME", id);
            }
            else if (data.Action == DSInteractiveEntryData.SENT_TO_DOCK)
            {
                data.Action   = DSInteractiveEntryData.ARRIVED_AT_DOCK;
                data.STDValue = now.ToShortTimeString();

                SQL_dockSchedule.InsertTime("SENT_TIME", id);
            }
            else if (data.Action == DSInteractiveEntryData.ARRIVED_AT_DOCK)
            {
                data.Action      = DSInteractiveEntryData.DEPARTED_DOCK;
                data.TimeInValue = now.ToShortTimeString();

                SQL_dockSchedule.InsertTime("IN_TIME", id);
            }
            else if (data.Action == DSInteractiveEntryData.DEPARTED_DOCK)
            {
                SQL_dockSchedule.InsertTime("OUT_TIME", id);
                LoadDailySchedule();
            }
        }
Exemplo n.º 11
0
        public void LoadDailySchedule()
        {
            if (DateLock == false)
            {
                var regDate = DateTime.Now;
                DateStamp = regDate.ToString("MM/dd/yyyy");
            }

            SQL_search.RunQuery("db_Harbor", $"SELECT TOP {MAX_ENTRIES} * FROM DS_SCHEDULE WHERE CONVERT(varchar, SCHEDULE_TIME, 101) = '" + DateStamp + "' AND (OUT_TIME IS NULL AND CANCELLED_TIME IS NULL) AND LOCATION = '" + MachineData.appLocation + "' ORDER BY SCHEDULE_TIME ASC");
            // SQL_search.RunQuery("db_Harbor", $"SELECT TOP {MAX_ENTRIES} * FROM DS_SCHEDULE WHERE CONVERT(varchar, SCHEDULE_TIME, 101) = '09/30/2019' AND (OUT_TIME IS NULL AND CANCELLED_TIME IS NULL) AND LOCATION = '" + MachineData.appLocation + "' ORDER BY SCHEDULE_TIME ASC");

            ScheduledRows = SQL_search.RecordCount;

            if (ScheduledRows > 0)
            {
                _parent._parent._vm.ShowMessage("");
                DateLock = true;
                int     i = 0;
                DataRow dr;
                for (; i < ScheduledRows; i++)
                {
                    dr = SQL_search.Ds.Tables[0].Rows[i];
                    ScheduleRow(i, dr);
                }
                for (; i < MAX_ENTRIES; i++)
                {
                    ScheduleRow(i, null);
                }
            }
            else
            {
                for (int i = 0; i < MAX_ENTRIES; i++)
                {
                    ScheduleRow(i, null);
                }
                _parent._parent._vm.ShowMessage("complete");
                DateLock      = false;
                ScheduledRows = 0;
            }
        }
Exemplo n.º 12
0
 //VERIFY CONNECTION-------------------------
 public bool VerifyDatabaseConnection()
 {
     return(SQL_search.HasConnection("db_Harbor"));
 }