Пример #1
0
 public void Api_OnQuote(MT5API api, Quote args)
 {
     //if(connectStatus.ToString() == "Disconnect" || connectStatus.ToString() == "Exception")
     //    Start(ulong.Parse(connectionModel.Username), connectionModel.Password, connectionModel.Address, port);
     System.Threading.Thread.Sleep(delay);
     if (delay != 0)
     {
         SMTP.SendEmail(api.Account.Email, api.Account.UserName,
                        $"Fin Instrument - '{args.Symbol}'\nDelay starts for the '{delay}' seconds!!!");
     }
     Bid  = args.Bid;
     Ask  = args.Ask;
     Time = args.Time;
 }
Пример #2
0
        public static void NotifyByEmail(string recipient)
        {
            //get list of recipients to see if we actually have someone to email
            List <string> recips = new List <string>();

            recips.Add(recipient);
            if (recips.Count <= 0)
            {
                //MessageBox.Show("Must have someone to notify!");
                return;
            }
            string Subject = "UPDATE EMS";

            // simplest html table showing relevant info
            string HTMLBody = $@"
   <div class=""container"" style=""height: 200px; position: relative; "">
    <h1 style=""font-family:Arial;"">UPDATE EMS</h1>
  </div>
";
            //SMTP is a server service thing for sending mail. Quite relaxed
            SMTP smtp = new SMTP();

            List <string> emails = recips;

            //List<string> assigners = Assigners.Select(x => x.Value).ToList();

            smtp.Recipients = emails;
            //smtp.CCRecipients = assigners;
            smtp.bodyMessage = HTMLBody;
            smtp.subject     = Subject;
            smtp.from        = "UPDATE EMS <*****@*****.**>";

            smtp.SendEmail();

            //// send the email on a separate thread so that we don't have to wait for the SMTP server.
            //new Thread(() =>
            //{
            //      Thread.CurrentThread.IsBackground = true;
            //      /* run your code here */

            //      smtp.SendEmail();
            //}).Start();
            //mail.Send();
        }//butNotify_Click
Пример #3
0
        public void NotifyByEmail()
        {
            //get list of recipients to see if we actually have someone to email
            List <string> recips = new List <string>();

            if (Assignees.Any(x => x.Name == "DATA"))
            {
                recips = new List <string> {
                    "Nils.Bergmann @lenderlive.com",
                    "Dallin.Beutler @lenderlive.com",
                    "Cameron.Thibeaux @lenderlive.com",
                    "Robert.Cerami @lenderlive.com",
                    "Mike.Auyeung @lenderlive.com",
                    "Bradley.Gill @lenderlive.com",
                    "nils.bergmann @lenderlive.com",
                    "Andrew.Matel @lenderlive.com",
                    "wesley.rollings @lenderlive.com",
                    "luke.stanley @lenderlive.com",
                    "Wesley.Hamilton @lenderlive.com",
                    "britney.clark @lenderlive.com",
                    "*****@*****.**"
                };
            }
            recips.AddRange(Assignees.Select(x => x.Value).Where(x => !string.IsNullOrEmpty(x)));
            if (recips.Count <= 0)
            {
                return;
            }
            string build   = VersionSelector.SelectedVersionEnum.Name;
            string Subject = "EMS- " + build + " Notification: " + Model.ProjectName;

            // simplest html table showing relevant info
            string HTMLBody = $@"<table>
                           <tr><td><b>Project:     </b></td><td>  { Model.ProjectName }<td/></tr>
                           <tr><td><b>Description: </b></td><td>  { Model.Description}<td/></tr>"
                              + (Model.EndDate.HasValue ? ($@"<tr><td><b>End Date:    </b></td><td>  { Model.EndDate.Value.ToShortDateString()} <td/></tr>)") : "") +
                              $@"<tr><td><b>Status:      </b></td><td>  { Model.Status}<td/></tr>
                           <tr><td><b>Division:    </b></td><td>  { Model.Division}<td/></tr>
                           <tr><td><b>Division:    </b></td><td>  { Model.Category}<td/></tr>
                           <tr><td><b>Assigned To: </b></td><td>  { string.Join(", ", recips)}<td/></tr>
                           <tr><td><b>Comments:    </b></td><td>  { EMS2.Utility.RtfToHtmlConverter.ConvertRtfToHtml(Model.Comments)}<td/></tr>
                            </table> ";

            //SMTP is a server service thing for sending mail. Quite relaxed
            SMTP smtp = new SMTP();


            List <string> emails    = recips;
            List <string> assigners = Assigners.Select(x => x.Value).ToList();


            smtp.Recipients   = emails;
            smtp.CCRecipients = assigners;
            smtp.bodyMessage  = HTMLBody;
            smtp.subject      = Subject;
            smtp.from         = "EMS " + build + " <*****@*****.**>";


            //Don't send a prompt to robert, but yes to everyone else. talk about customization!
            //if (!EMSSession.IsAdmin)
            //{
            //   var result = MessageBox.Show("Do you want to send an email to " + string.Join(", ", emails) + "\n" + "with " + string.Join(", ", assigners) + " CC'd?", "Confirm Email", MessageBoxButton.YesNo);
            //   if (result != MessageBoxResult.Yes) return;
            //}

            // send the email on a separate thread so that we don't have to wait for the SMTP server.
            new Thread(() =>
            {
                try
                {
                    Thread.CurrentThread.IsBackground = true;
                    /* run your code here */

                    smtp.SendEmail();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message).ToString();
                }
            }).Start();
            //mail.Send();
        }//butNotify_Click