Ejemplo n.º 1
0
        public StartPage()
        {
            try
            {
                InitializeComponent();
                //_dbConnectionString = "Data Source=SAMBRAHMA\\SQLEXPRESS;database=IAS_Schneider;User id=sa; Password=mei123$%^;";
                _dbConnectionString  = ConfigurationSettings.AppSettings["DBConStr"];

                string lineList = ConfigurationSettings.AppSettings["LINES"];

                whID = Convert.ToInt32(ConfigurationSettings.AppSettings["WH_ID"]);

                DataAccess.conStr = _dbConnectionString;

                MainMenu _mainMenu = new MainMenu(_dbConnectionString);
                _mainFrame.Navigate(_mainMenu);
                dataAccess = new DataAccess();
                lines = dataAccess.getLines();
                lineQ = new Queue<int>();
                String[] linesLst = separateCommandData(lineList);

                foreach (line l in lines)
                {
                    foreach (String s in linesLst)
                    {

                        if (l.ID == Convert.ToInt32(s))
                        {
                            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();


                xmlSerializer = new XmlSerializer(typeof(AndonAlertEventArgs));

                serverType = ConfigurationSettings.AppSettings["ServerType"];
                dataAccess.updateIssueMarquee();


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

                commandTimer.Start();

                Issues = new Dictionary<int, Issue>();
                timeout = dataAccess.getEscalationTimeout();
                               
                
                andonManager.andonAlertEvent += new EventHandler<AndonAlertEventArgs>(andonManager_andonAlertEvent);

                andonManager.start();
               
            }
            catch( Exception e)
            {
                tbMsg.Text+= e.Message;
            }
        }
        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;
            }
        }