Ejemplo n.º 1
0
        private bool SavePost()
        {
            if (!FormValidation())
            {
                return(false);
            }

            //Only exports part of the generated HTML document by RichEditControlDescription.HTMLText
            var options = new HtmlDocumentExporterOptions();

            options.ExportRootTag           = ExportRootTag.Body;
            options.CssPropertiesExportType = CssPropertiesExportType.Inline;
            options.DefaultCharacterPropertiesExportToCss = false;
            var    exporter             = new HtmlExporter(RichEditControlDescription.Model, options);
            string formattedDescription = exporter.Export();

            if (_post == null)
            {
                _post = new Post(Environment.UserName, TitleTextBox.Text, formattedDescription);
            }
            else
            {
                _post = new Post(_post.Id, _post.Author, TitleTextBox.Text, formattedDescription, _post.LastModifiedTime);
            }

            try
            {
                try
                {
                    _dataConnection.AddOrUpdatePost(_post);
                    Close();
                }
                catch (ModifiedByOtherUserException ex)
                {
                    if (MessageBox.Show(this,
                                        "The post was modified by some other user. Do you want to overwrite those changes?",
                                        this.Text,
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                    {
                        return(false);
                    }

                    _dataConnection.AddOrUpdatePost(_post, true);
                    Close();
                }
                catch (TitleAlreadyPresentInDBException ex)
                {
                    MessageBox.Show(this, ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, $"Fallimento nell'inserimento del post: {ex.Message}", this.Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
 //private string get_email(decimal ip_id_nhan_vien)
 //{
 //    //US_DM_NHAN_VIEN v_us = new US_DM_NHAN_VIEN(ip_id_nhan_vien);
 //    //return v_us.strEMAIL;
 //    return "*****@*****.**";
 //}
 private string ExportHtml()
 {
     string stringHtml = String.Empty;
     HtmlDocumentExporterOptions options = new HtmlDocumentExporterOptions();
     options.ExportRootTag = ExportRootTag.Body;
     options.CssPropertiesExportType = CssPropertiesExportType.Inline;
     var exporter = new HtmlExporter(this.m_txt_noi_dung.Model, options);
     return stringHtml = exporter.Export();
 }
Ejemplo n.º 3
0
        private void ExportHtml(EditorCanvas canvas, HtmlExporter exporter, string rootPath, string tagFullName, string memoTitle)
        {
            var dirPath = Path.Combine(rootPath, PathUtil.GetValidRelativePath(tagFullName, "_"));

            dirPath = Path.Combine(dirPath, PathUtil.GetValidFilename(memoTitle, "_"));
            dirPath = Path.GetFullPath(dirPath);
            dirPath = PathUtil.GetUniqueDirectoryPathByCounting(dirPath);
            PathUtil.EnsureDirectoryExists(dirPath);
            exporter.Export(dirPath, canvas);
        }
        private void ExportHtml(out string stringHtml, HtmlExporter exporter, string fileName)
        {
            stringHtml = String.Empty;
            HtmlDocumentExporterOptions options = new HtmlDocumentExporterOptions();

            options.ExportRootTag           = htmlExportType;
            options.CssPropertiesExportType = cssExportType;
            options.TargetUri = Path.GetFileNameWithoutExtension(fileName);
            exporter          = new HtmlExporter(this.richEditControl1.Model, options);
            stringHtml        = exporter.Export();
        }
Ejemplo n.º 5
0
        public static string HtmlToRtf(this RichEditControl richEditControl, string markup)
        {
            HtmlDocumentExporterOptions options = new HtmlDocumentExporterOptions();

            options.ExportRootTag           = ExportRootTag.Body;
            options.CssPropertiesExportType = CssPropertiesExportType.Inline;
            HtmlExporter exporter   = new HtmlExporter(richEditControl.Model, options);
            string       stringHtml = exporter.Export();

            return(stringHtml);
        }
Ejemplo n.º 6
0
        //private string get_email(decimal ip_id_nhan_vien)
        //{
        //    //US_DM_NHAN_VIEN v_us = new US_DM_NHAN_VIEN(ip_id_nhan_vien);
        //    //return v_us.strEMAIL;
        //    return "*****@*****.**";
        //}

        private string ExportHtml()
        {
            string stringHtml = String.Empty;
            HtmlDocumentExporterOptions options = new HtmlDocumentExporterOptions();

            options.ExportRootTag           = ExportRootTag.Body;
            options.CssPropertiesExportType = CssPropertiesExportType.Inline;
            var exporter = new HtmlExporter(this.m_txt_noi_dung.Model, options);

            return(stringHtml = exporter.Export());
        }
Ejemplo n.º 7
0
        private void _saveAsHtmlToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_currentEditorCanvas == null)
            {
                return;
            }

            using (var dialog = new FolderBrowserDialog()) {
                dialog.Description         = "保存先のフォルダを選択してください。";
                dialog.RootFolder          = Environment.SpecialFolder.Desktop;
                dialog.ShowNewFolderButton = true;

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    EnsureFocusCommited();
                    var exporter = new HtmlExporter();
                    exporter.Export(dialog.SelectedPath, _EditorCanvas);
                }
            }
        }
Ejemplo n.º 8
0
        private static int handleExportHtml(MonoCovOptions opts,string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Error: Datafile name is required when using --export-html");
                return(1);
            }

            if (!Directory.Exists(opts.exportHtmlDir))
            {
                try {
                    Directory.CreateDirectory(opts.exportHtmlDir);
                }
                catch (Exception ex) {
                    Console.WriteLine("Error: Destination directory '" + opts.exportHtmlDir + "' does not exist and could not be created: " + ex);
                    return(1);
                }
            }

            CoverageModel model = new CoverageModel();

            model.ReadFromFile(args [0]);
            HtmlExporter exporter = new HtmlExporter();

            exporter.DestinationDir = opts.exportHtmlDir;
            exporter.StyleSheet     = opts.styleSheet;
            if (!opts.quiet)
            {
                exporter.Progress += new HtmlExporter.ProgressEventHandler(htmlProgressListener);
            }
            exporter.Export(model);
            if (!opts.quiet)
            {
                Console.WriteLine();
                Console.WriteLine("Done.");
            }
            return(0);
        }
Ejemplo n.º 9
0
        private void SendSimpleButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(toMailTextEdit.Text))
                {
                    MessageBox.Show("Please Enter Valid EmailId");
                    return;
                }
                else if (string.IsNullOrEmpty(subjectTextEdit.Text))
                {
                    MessageBox.Show("Please Enter Valid Subject");
                    return;
                }
                else if (string.IsNullOrEmpty(termsRichEditControl.Text))
                {
                    MessageBox.Show("Please Enter Valid Message");
                    return;
                }

                // company object
                MailBee.Global.LicenseKey = "MN120-4FA35C0C24043460043189003820-98EF";
                splashScreenManager1.ShowWaitForm();
                splashScreenManager1.SetWaitFormDescription("Sending Mail...");
                Smtp       mailer = new Smtp();
                SmtpServer server = new SmtpServer(Comp.EmailPass, Comp.SendFrom, Comp.SendPass);

                string strBody = string.Empty;
                server.SslMode = SslStartupMode.UseStartTls;
                server.Port    = Convert.ToInt32(Comp.SortName); // Convert.ToInt32(Comp.);
                mailer.SmtpServers.Add(server);
                mailer.From.Email = Comp.SendFrom;
                mailer.Subject    = subjectTextEdit.Text;

                HtmlDocumentExporterOptions options = new HtmlDocumentExporterOptions();
                options.ExportRootTag           = ExportRootTag.Body;
                options.CssPropertiesExportType = CssPropertiesExportType.Inline;
                HtmlExporter exporter   = new HtmlExporter(this.termsRichEditControl.Model, options);
                string       stringHtml = exporter.Export();

                mailer.BodyHtmlText = stringHtml;

                if (!string.IsNullOrEmpty(atch1ButtonEdit.Text))
                {
                    mailer.Message.Attachments.Add(atch1ButtonEdit.Text);
                }
                if (!string.IsNullOrEmpty(atch2ButtonEdit.Text))
                {
                    mailer.Message.Attachments.Add(atch2ButtonEdit.Text);
                }
                if (!string.IsNullOrEmpty(atch3ButtonEdit.Text))
                {
                    mailer.Message.Attachments.Add(atch3ButtonEdit.Text);
                }
                if (!string.IsNullOrEmpty(atch4ButtonEdit.Text))
                {
                    mailer.Message.Attachments.Add(atch4ButtonEdit.Text);
                }

                string[] strparty = toMailTextEdit.Text.Split(';');
                foreach (var mail in strparty)
                {
                    if (!string.IsNullOrEmpty(mail))
                    {
                        mailer.Message.To.Add(mail);
                    }
                }

                if (!string.IsNullOrEmpty(ccMailTextEdit.Text))
                {
                    mailer.Cc.Add(ccMailTextEdit.Text);
                }

                if (!string.IsNullOrEmpty(bccMailTextEdit.Text))
                {
                    mailer.Bcc.Add(bccMailTextEdit.Text);
                }

                if (mailer.Send())
                {
                    splashScreenManager1.CloseWaitForm();
                    MessageBox.Show("Email Send Successfully.....");
                    this.Close();
                    this.Dispose();
                }
                else
                {
                    splashScreenManager1.CloseWaitForm();
                    MessageBox.Show("Email Not Sended Successfully");
                }
            }
            catch (Exception ex)
            {
                if (splashScreenManager1.IsSplashFormVisible)
                {
                    splashScreenManager1.CloseWaitForm();
                }
                Serilog.Log.Error(ex, "Error While Sending Mail");
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 10
0
        private static int handleExportHtml(MonoCovOptions opts, string[] args)
        {
            if (args.Length == 0) {
            Console.WriteLine ("Error: Datafile name is required when using --export-html");
            return 1;
            }

            if (!Directory.Exists (opts.exportHtmlDir)) {
            try {
                Directory.CreateDirectory (opts.exportHtmlDir);
            }
            catch (Exception ex) {
                Console.WriteLine ("Error: Destination directory '" + opts.exportHtmlDir + "' does not exist and could not be created: " + ex);
                return 1;
            }
            }

            CoverageModel model = new CoverageModel ();
            model.ReadFromFile (args [0]);
            HtmlExporter exporter = new HtmlExporter ();
            exporter.DestinationDir = opts.exportHtmlDir;
            exporter.StyleSheet = opts.styleSheet;
            if (!opts.quiet)
            exporter.Progress += new HtmlExporter.ProgressEventHandler (htmlProgressListener);
            exporter.Export (model);
            if (!opts.quiet) {
            Console.WriteLine ();
            Console.WriteLine ("Done.");
            }
            return 0;
        }
Ejemplo n.º 11
0
 public void WhenIExport()
 {
     _exporter.Export();
 }