Exemple #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (con.getValueBool("select * from Shutdown_Monitoring where Solved=false and Not1=true") == true)
            {
                email.writeBody("select Equipment, Shutdown_Time,Description from Shutdown_Monitoring where Solved=false and Not1=true", "Equipos dentenidos.", "n");
                email.sendEmail("*****@*****.**",
                                "Notificación. Equipo detenido", "*****@*****.**");
                ChangeNot();
            }
            if (con.getValueBool("select * from Shutdown_Monitoring where Not2=true") == true)
            {
                email.writeBody("select Equipment, Shutdown_Time,Description from Shutdown_Monitoring where Not2=true", "Equipo(s) reiniciado(s).", "n");
                email.sendEmail(allGroup,
                                "Notificación. Equipo reiniciado.", "*****@*****.**");
                ChangeStr();
            }
            timerNotfitication();

            if (checkTurn() == true)
            {
                allStops();
            }
            //track.getNewNotify();
            //track.makeEmail();
            noticon.ReadNewNotify();
        }
        public void makeEmail()
        {
            if (areasId.Count > 0)
            {
                foreach (string s in areasId)
                {
                    int    actualArea = 0;
                    int    nextArea   = 0;
                    string to         = "";
                    string batch      = "";


                    actualArea = Convert.ToInt32(mycon.getValue(
                                                     string.Format("select a.orden from area_orden as b inner join Areas as a on b.AreaId=a.AreaId where b.Area_OrdenId={0}",
                                                                   s)));
                    batch = mycon.getValue(string.Format(
                                               "select w.BatchOrden from workordens as w inner join area_orden as a on w.workordenid=a.workordenid where a.area_ordenid={0}",
                                               s));
                    if (actualArea != 6)
                    {
                        nextArea = actualArea + 1;
                        int newarea = Convert.ToInt32(mycon.getValue(string.Format("select AreaId from Areas where orden={0}", nextArea)));
                        emails.Clear();
                        mycon.fillList(emails, string.Format("select emailuser from users where areaid={0}", newarea));

                        foreach (string e in emails)
                        {
                            email.writeBody(batch);
                            email.sendEmail(e, string.Format("Notificación de TrackBatch: Nuevo batch por iniciar (No. {0})", batch),
                                            "");
                        }
                    }
                    mycon.executeQuery(string.Format("update Area_orden set notify=false where area_ordenid={0}", s));
                }
            }
        }