Exemplo n.º 1
0
        public lineCollection getLines(String lineList)
        {
            SqlConnection con = new SqlConnection(conStr);
            con.Open();

            lineCollection lines = new lineCollection();

            String qry = String.Empty;
            qry = @"SELECT id , description FROM lines where id in ({0}) ORDER BY id";

            qry = String.Format(qry, lineList);

            SqlCommand cmd = new SqlCommand(qry, con);
            SqlDataReader dr = cmd.ExecuteReader();
            DataTable dt = new DataTable();
            dt.Load(dr);
            dr.Close();
            cmd.Dispose();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                lines.add(new line((int)dt.Rows[i]["id"], (string)dt.Rows[i]["description"]));
            }

            con.Close();
            con.Dispose();
            return lines;
        }
        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;
            }
        }
Exemplo n.º 3
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;
            }
        }