示例#1
0
        public void SendCode()
        {
            EmailProcessor email = new EmailProcessor {
                Email = Recipient
            };

            email.Send("Fare matrix account recovery.",
                       $"Hello, Good Day.\nThis is your recovery code for your account : {recoveryCode} \n\n\n-Fare matrix developer");
        }
示例#2
0
        private void DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            WebBrowser browser = sender as WebBrowser;

            if (browser == null)
            {
                return;
            }

            if (browser.Document == null || browser.Document.Body == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(browser.Tag.ToString()))
            {
                return;
            }

            File.Delete(browser.Tag.ToString());

            browser.Document.Body.Style = "zoom:100%;";

            var element = browser.Document.GetElementById("ReportParameterPanel");

            if (element != null)
            {
                element.OuterHtml = "";
                element.InnerHtml = "";
            }

            if (browser.Document.Body != null)
            {
                const int margin    = 100;
                var       height    = browser.Document.Body.ScrollRectangle.Height + margin;
                var       width     = browser.Width;
                var       imagePath = browser.Tag.ToString().Replace(".html", ".png");

                using (Bitmap bitmap = new Bitmap(width + 2 * margin, height))
                {
                    using (Graphics g = Graphics.FromImage(bitmap))
                    {
                        g.Clear(Color.White);
                        g.DrawImage(bitmap, 0, 0, width + 2 * margin, height);
                    }

                    browser.DrawToBitmap(bitmap, new Rectangle(margin, 0, width, height));
                    bitmap.SetResolution(3200, 3200);
                    bitmap.Save(imagePath, GetEncoder(ImageFormat.Png), null);

                    EmailProcessor processor = new EmailProcessor();
                    processor.Send(this.Recipient, this.Subject, this.EmailBody, EmailAttachment.GetAttachments(imagePath));
                }
            }
        }
        public bool ValidateAccount()
        {
            bool           IsValid    = false;
            AdminAccount   admin      = new AdminAccount();
            EmailProcessor adminEmail = new EmailProcessor {
                Email = Email
            };

            if (RequiredFields() == true && PasswordConfirmation() == true && EmailValidation() == true &&
                PasswordValidation() == true)
            {
                string information = $"'{FirstName}', '{MiddleName}', '{Lastname}'";
                string account     = $"'{Username}', '{Email}', '{Password}'";

                admin.Save(information, account);
                admin.SaveImage(image);
                adminEmail.Send("Fare Matrix Registration",
                                "Your account is now verified. You can now safely use the Application.\nYou can use this email to recover your account on our application.\n\n-Fare Matrix Developer");

                IsValid = true;
            }

            return(IsValid);
        }
示例#4
0
        private void Serializer_ImageSaved(object sender, ImageSavedEventArgs e)
        {
            EmailProcessor processor = new EmailProcessor();

            processor.Send(this.Recipient, this.Subject, this.EmailBody, EmailAttachment.GetAttachments(e.ImagePath));
        }