Пример #1
0
    private void ShowTemplate(MailTemplate currentTemplate)
    {
        this.LabelCountryName.Text = Country.FromCode(currentTemplate.CountryCode).Name;
        this.LabelOrgName.Text     = "";
        if (currentTemplate.OrganizationId != 0)
        {
            this.LabelOrgName.Text = Organization.FromIdentity(currentTemplate.OrganizationId).Name;
            ButtonSave.Visible     = _authority.HasPermission(Permission.CanEditMailTemplates, currentTemplate.OrganizationId, -1, Authorization.Flag.Default);
        }
        else
        {
            ButtonSave.Visible = _authority.HasPermission(Permission.CanEditMailTemplates, Organization.RootIdentity, -1, Authorization.Flag.Default);
        }

        this.LabelTemplateName.Text  = currentTemplate.TemplateName;
        CurrentTemplateNameViewState = currentTemplate.TemplateName;
        CurrentTemplateIdViewState   = currentTemplate.TemplateId;
        currentTemplate.NormalizeHtml();

        TypedMailTemplate           typedTemplate = TypedMailTemplate.FromName(currentTemplate.TemplateName);
        Dictionary <string, string> placeholders  = new Dictionary <string, string>();

        foreach (string ph in typedTemplate.Placeholders.Keys)
        {
            placeholders.Add(ph.ToLower(), ph);
        }

        currentTemplate.MarkPlaceholderSpans(placeholders);

        RadEditor1.Content  = currentTemplate.TemplateBody;
        TextBoxSubject.Text = currentTemplate.TemplateTitle;
        SetEditorToolbar();
    }
Пример #2
0
    private void SetEditorToolbar()
    {
        EditorToolGroup foundgroup = null;

        foreach (EditorToolGroup tg in RadEditor1.Tools)
        {
            if (tg.Attributes["id"] == "placeholders")
            {
                foundgroup = tg;
            }
        }
        if (foundgroup != null)
        {
            RadEditor1.Tools.Remove(foundgroup);
        }

        EditorToolGroup main = new EditorToolGroup();

        main.Attributes["id"] = "placeholders";
        RadEditor1.Tools.Add(main);

        //add a custom dropdown and set its items and dimension attributes
        EditorDropDown ddn = new EditorDropDown("PlaceHolders");

        ddn.Text = "Place holders";

        //Set the popup width and height
        ddn.Attributes["width"]       = "110px";
        ddn.Attributes["popupwidth"]  = "240px";
        ddn.Attributes["popupheight"] = "200px";

        if (CurrentTemplateNameViewState != "")
        {
            TypedMailTemplate tmpl = TypedMailTemplate.FromName(CurrentTemplateNameViewState);

            foreach (string key in tmpl.Placeholders.Keys)
            {
                if (tmpl.Placeholders[key].TagOrId == TypedMailTemplate.PlaceholderType.Tag)
                {
                    ddn.Items.Add(tmpl.Placeholders[key].Label, " <span class='placeholder2' >%" + tmpl.Placeholders[key].Name + "%</span> ");
                }
                else if (tmpl.Placeholders[key].TagOrId == TypedMailTemplate.PlaceholderType.Id)
                {
                    ddn.Items.Add(tmpl.Placeholders[key].Label, " <div id=\"" + tmpl.Placeholders[key].Name + "\" class='placeholder1' > " + tmpl.Placeholders[key].Label + " </div> ");
                }
                else
                {
                    ddn.Items.Add(tmpl.Placeholders[key].Label, " <span id=\"" + tmpl.Placeholders[key].Name + "\" class='placeholder1' > <span class='placeholder2' >%" + tmpl.Placeholders[key].Name + "%</span> </span> ");
                }
            }
        }

        //Add tool to toolbar
        main.Tools.Add(ddn);
    }
Пример #3
0
    private void BuildTable()
    {
        tab.Rows.Clear();

        OutboundMails mails = OutboundMails.FromArray(PirateDb.GetDatabase().GetOutboundMailQueue(500));

        TableRow row = new TableRow();

        tab.Rows.Add(row);
        TableCell c = new TableCell(); row.Cells.Add(c);

        c.Text = "Template";

        c      = new TableCell(); row.Cells.Add(c);
        c.Text = "Title";

        c      = new TableCell(); row.Cells.Add(c);
        c.Text = "Release time";

        c      = new TableCell(); row.Cells.Add(c);
        c.Text = "Time until release";

        c      = new TableCell(); row.Cells.Add(c);
        c.Text = "Counts";

        c      = new TableCell(); row.Cells.Add(c);
        c.Text = "Started";

        foreach (OutboundMail mail in mails)
        {
            TypedMailTemplate tmpl = null;
            if (mail.MailType != 0)
            {
                tmpl = TypedMailTemplate.FromName(mail.Title);
                tmpl.Initialize("SE", mail.OrganizationId, mail, "");
                tmpl.InsertAllPlaceHoldersToTemplate();
            }
            row = new TableRow();
            tab.Rows.Add(row);

            if (mail.MailType != 0)
            {
                c      = new TableCell(); row.Cells.Add(c);
                c.Text = mail.Title;

                c      = new TableCell(); row.Cells.Add(c);
                c.Text = tmpl.Template.TemplateTitleText;
            }
            else
            {
                c      = new TableCell(); row.Cells.Add(c);
                c.Text = "none";

                c      = new TableCell(); row.Cells.Add(c);
                c.Text = mail.Title;
            }
            c      = new TableCell(); row.Cells.Add(c);
            c.Text = mail.ReleaseDateTime.ToString();
            if ((new DateTime(1970, 1, 1)) == mail.StartProcessDateTime && mail.ReleaseDateTime < DateTime.Now)
            {
                c.ForeColor = System.Drawing.Color.Red;
                c.Font.Bold = true;
            }

            c      = new TableCell(); row.Cells.Add(c);
            c.Text = Math.Round((DateTime.Now.Subtract(mail.ReleaseDateTime).TotalMinutes)).ToString();


            c       = new TableCell(); row.Cells.Add(c);
            c.Text  = mail.RecipientCount.ToString();
            c.Text += " / " + mail.RecipientsSuccess.ToString();
            c.Text += " / " + mail.RecipientsFail.ToString();

            c      = new TableCell(); row.Cells.Add(c);
            c.Text = mail.StartProcessDateTime.ToString();
        }
    }