Пример #1
0
        public StartPage()
        {
            try
            {
                InitializeComponent();
                _dbConnectionString = ConfigurationSettings.AppSettings["DBConStr"];

                DataAccess.conStr = _dbConnectionString;

                MainMenu _mainMenu = new MainMenu(_dbConnectionString);
                _mainFrame.Navigate(_mainMenu);
                dataAccess = new DataAccess();
                lines      = dataAccess.getLines();
                lineQ      = new Queue <int>();

                foreach (line l in lines)
                {
                    lineQ.Enqueue(l.ID);
                }

                reference = new Reference();

                andonManager = new AndonManager(AndonManager.MODE.SLAVE);

                andonManager.andonAlertEvent += new EventHandler <AndonAlertEventArgs>(andonManager_andonAlertEvent);

                andonManager.start();
            }

            catch (Exception e)
            {
                tbMsg.Text += e.Message;
            }
        }
        public LineManagement(String dbConnectionString)
        {
            InitializeComponent();
            _dbConnectionString = dbConnectionString;

            if (dataAccess == null)
            {
                dataAccess = new DataAccess(_dbConnectionString);
            }

            lines        = dataAccess.getLines();
            lines.Header = "LINES";

            lineControl.DataContext = lines;
            ((Label)lineControl.aMDGroupBox.Header).Content    = "LINES";
            ((Label)stationControl.aMDGroupBox.Header).Content = "REFERENCES";


            stationControl.allowModification();
        }
        public LineManagement()
        {
            InitializeComponent();
            if (dataAccess == null)
            {
                dataAccess = new DataAccess();
            }

            lines = dataAccess.getLines();

            lines.Header            = "LINES";
            lineControl.DataContext = lines;
            ((Label)lineControl.aMDGroupBox.Header).Content      = "LINES";
            ((Label)stationControl.aMDGroupBox.Header).Content   = "STATIONS";
            ((Label)breakdownControl.aMDGroupBox.Header).Content = "BREAKDOWN";
            ((Label)qualityControl.aMDGroupBox.Header).Content   = "QUALITY";

            dt = dataAccess.GetOpenIssues();
            dgOpenIssuesGrid.DataContext = dt;
            stationControl.allowModification();
        }
Пример #4
0
        public StartPage()
        {
            try
            {
                InitializeComponent();
                _dbConnectionString = ConfigurationSettings.AppSettings["DBConStr"];

                DataAccess.conStr = _dbConnectionString;

                MainMenu _mainMenu = new MainMenu(_dbConnectionString);
                _mainFrame.Navigate(_mainMenu);
                dataAccess = new DataAccess();
                lines      = dataAccess.getLines();
                lineQ      = new Queue <int>();

                foreach (line l in lines)
                {
                    lineQ.Enqueue(l.ID);
                }

                departmentTable = dataAccess.getDepartmentInfo("");

                departmentQ = new Queue <int>();
                for (int i = 0; i < departmentTable.Rows.Count; i++)
                {
                    departmentQ.Enqueue((int)departmentTable.Rows[i]["id"]);
                }
                andonManager = new AndonManager(lineQ, departmentQ, AndonManager.MODE.MASTER);

                shifts = dataAccess.getShifts();

                contacts = dataAccess.getContacts();

                commandTimer           = new System.Timers.Timer(30 * 1000);
                commandTimer.Elapsed  += new System.Timers.ElapsedEventHandler(commandTimer_Elapsed);
                commandTimer.AutoReset = false;

                commandTimer.Start();


                hourlyUpdateTimings = new Queue <TimeSpan>();
                shiftUpdateTimings  = new Queue <TimeSpan>();
                String hourlyUpdateTimingsString = ConfigurationSettings.AppSettings["HourlyUpdateTimings"];

                String[] hourlyUpdateTimingsList = hourlyUpdateTimingsString.Split(dataSeperator.ToCharArray());

                foreach (String s in hourlyUpdateTimingsList)
                {
                    String[] timings = s.Split(timingsDataSeperator.ToCharArray());

                    int hours   = Convert.ToInt32(timings[0]);
                    int minutes = Convert.ToInt32(timings[1]);
                    int seconds = Convert.ToInt32(timings[2]);
                    hourlyUpdateTimings.Enqueue(new TimeSpan(hours, minutes, seconds));
                }

                TimeSpan[] temp = new TimeSpan[hourlyUpdateTimings.Count];
                hourlyUpdateTimings.CopyTo(temp, 0);

                /*
                 * foreach (TimeSpan ts in temp)
                 * {
                 *  TimeSpan ts1 = hourlyUpdateTimings.Dequeue();
                 *  hourlyUpdateTimings.Enqueue(ts1);
                 *  if (ts >= DateTime.Now.TimeOfDay)
                 *  {
                 *      nextHourlyUpdateTiming = ts;
                 *      break;
                 *  }
                 *
                 * }
                 */
                nextHourlyUpdateTiming = getNextHourlyUpdateTime();

                Issues  = new Dictionary <int, Issue>();
                timeout = dataAccess.getEscalationTimeout();


                andonManager.andonAlertEvent += new EventHandler <AndonAlertEventArgs>(andonManager_andonAlertEvent);

                andonManager.start();

                dataAccess.updateIssueMarquee();
            }



            catch (Exception e)
            {
                tbMsg.Text += e.Message;
            }
        }