Ejemplo n.º 1
0
        public void ReadNewNotify()
        {
            List <string> listIDs = new List <string>();

            con.fillList("select ID from Emails where Sent=false", listIDs);
            if (listIDs.Count > 0)
            {
                foreach (string s in listIDs)
                {
                    to      = con.getValue(string.Format("select Para from Emails where ID={0}", s));
                    copy    = con.getValue(string.Format("select CC from Emails where ID={0}", s));
                    from    = con.getValue(string.Format("select De from Emails where ID={0}", s));
                    subject = con.getValue(string.Format("select Subject from Emails where ID={0}", s));
                    body    = con.getValue(string.Format("select BodyFile from Emails where ID={0}", s));
                    if (body != "")
                    {
                        email.writeBodyNotify(body);
                        email.sendEmail(to, subject, copy, from);
                    }
                    con.executeQuery(string.Format("update Emails set Sent=true where ID={0}", s));
                    try
                    {
                        File.Delete(@"\\mxtswtjnts\Groups\GRP Tijuana Departments\Plastics\2015 Plastics DB\CAPA Tool\TempFiles\" + body);
                    }
                    catch { }
                }
            }
        }
Ejemplo n.º 2
0
        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));
                }
            }
        }