コード例 #1
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindDataToPage()
        {
            //Dictionary<string, Locale> Locales = DotNetNuke.Services.Localization.LocaleController.Instance.GetLocales(PortalId);
            //System.Text.StringBuilder sb = new System.Text.StringBuilder();
            //sb.Append("<div class=\"btn-group btn-group-xs\">").AppendLine();


            //foreach (var locale in Locales)
            //{
            //    sb.AppendFormat("<a href=\"{0}\" class=\"btn btn-default {2}\">{1}</a>", xUrl("TemplateLanguage", locale.Key, Token, "TemplateName="+ TemplateName), locale.Value.NativeName, locale.Key.ToLower() == TemplateLanguage.ToLower() ? "active":"").AppendLine();
            //}
            //sb.Append("</div>").AppendLine();
            //liLanguageLinks.Text = sb.ToString();


            //需要读取模版的设置
            Playngo_ClientZone_MailSetting Template = Playngo_ClientZone_MailSetting.FindByModuleId(ModuleId, TemplateName, TemplateLanguage);

            if (!(Template != null && Template.ID > 0))
            {
                Template = Playngo_ClientZone_MailSetting.FindByModuleId(ModuleId, TemplateName);//需要读取英语的数据库
            }

            if (!(Template != null && Template.ID > 0))
            {
                EmailTemplate eTemplate = new EmailTemplate(TemplateName, this, TemplateLanguage);//没有记录时,需要读取XML模板的信息
                Template.Name        = eTemplate.TemplateName;
                Template.language    = eTemplate.Language;
                Template.MailSubject = eTemplate.Title;
                Template.MailBody    = eTemplate.Body;
                Template.MailType    = eTemplate.MailType;
                Template.MailTo      = eTemplate.MailTo;
                Template.MailCC      = eTemplate.MailCC;
                Template.MailTime    = eTemplate.MailTime;
            }


            //需要显示时间框
            if (Template.Name == "User.Notification.Upcoming")
            {
                divMailTime.Visible = true;
            }



            cbEnable.Checked = Template.Status == 1;

            lbShowTemplateName.Text = TemplateName;
            lbShowLanguage.Text     = TemplateLanguage;

            txtMailSubject.Text = Template.MailSubject;
            txtMailBody.Text    = Template.MailBody;

            txtMailCC.Text   = Template.MailCC;
            txtMailTo.Text   = Template.MailTo;
            txtMailTime.Text = Template.MailTime.ToString();
        }
コード例 #2
0
        /// <summary>
        /// 利用线程发送订阅邮件
        /// </summary>
        /// <param name="ObjectItem"></param>8
        public void ThreadCreateSendMail(Object ObjectItem)
        {
            var objs = (Dictionary <object, object>)ObjectItem;

            Playngo_ClientZone_DownloadFile DataItem = (Playngo_ClientZone_DownloadFile)objs["DataItem"];

            if (DataItem != null && DataItem.ID > 0)
            {
                //这里需要调用所有邮件的信息
                NotificationEmail NotEmail = new NotificationEmail();
                //所有区域
                NotEmail.AllJurisdictions = Playngo_ClientZone_Jurisdiction.FindAllByModuleID(DataItem.ModuleId);
                //邮件设置
                NotEmail.MailSetting = Playngo_ClientZone_MailSetting.FindByModuleId(ModuleId, "Notification.Downloads");
                if (NotEmail.MailSetting != null && NotEmail.MailSetting.Status == 1)
                {
                    NotEmail.Settings = Settings;
                    NotEmail.Settings.Add("PortalUrl", objs["PortalUrl"]);
                    NotEmail.SendMail(DataItem);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// 设置数据项
        /// </summary>
        private void SetDataItem()
        {
            #region "邮件设置"


            Playngo_ClientZone_MailSetting Template = Playngo_ClientZone_MailSetting.FindByModuleId(ModuleId, TemplateName, TemplateLanguage);
            if (!(Template != null && Template.ID > 0))
            {
                Template = Playngo_ClientZone_MailSetting.FindByModuleId(ModuleId, TemplateName);//需要读取英语的数据库
            }

            if (!(Template != null && Template.ID > 0))
            {
                EmailTemplate eTemplate = new EmailTemplate(TemplateName, this, TemplateLanguage);//没有记录时,需要读取XML模板的信息
                Template.MailType = eTemplate.MailType;
            }


            Template.MailSubject = txtMailSubject.Text;
            Template.MailBody    = txtMailBody.Text;

            Template.MailCC = txtMailCC.Text;
            Template.MailTo = txtMailTo.Text;


            Template.MailTime = WebHelper.GetIntParam(Request, txtMailTime.UniqueID, 0);

            Template.Status = cbEnable.Checked ? 1 : 0;


            Template.LastIP   = WebHelper.UserHost;
            Template.LastTime = xUserTime.UtcTime();
            Template.LastUser = UserId;

            Template.ModulePath = ModulePath;


            if (Template != null && Template.ID > 0)
            {
                Template.Update();
            }
            else
            {
                Template.language = TemplateLanguage;
                Template.Name     = TemplateName;


                Template.CreateTime = xUserTime.LocalTime();
                Template.CreateUser = UserId;
                Template.PortalId   = PortalId;
                Template.ModuleId   = ModuleId;
                Template.TabID      = PortalSettings.ActiveTab.TabID;
                Template.Insert();
            }

            #endregion

            //初始化提醒调度器
            if (!ViewSettingT <Boolean>("NotificationSchedule_Init1", false))
            {
                NotificationSchedule Schedule = new NotificationSchedule();
                Schedule.UpdateScheduler(this);

                UpdateModuleSetting("NotificationSchedule_Init1", "true");
            }
        }