本文整理汇总了C#中DotNetNuke.UI.Skins.Controls.ModuleMessage类的典型用法代码示例。如果您正苦于以下问题:C# ModuleMessage类的具体用法?C# ModuleMessage怎么用?C# ModuleMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleMessage类属于DotNetNuke.UI.Skins.Controls命名空间,在下文中一共展示了ModuleMessage类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsReadyToSend
private bool IsReadyToSend(List<string> roleNames, List<UserInfo> users, ref string message, ref ModuleMessage.ModuleMessageType messageType)
{
if (String.IsNullOrEmpty(txtSubject.Text) || String.IsNullOrEmpty(teMessage.Text))
{
message = Localization.GetString("MessageValidation", LocalResourceFile);
messageType = ModuleMessage.ModuleMessageType.RedError;
return false;
}
if (users.Count == 0 && roleNames.Count == 0)
{
message = string.Format(Localization.GetString("NoRecipients", LocalResourceFile), -1);
messageType = ModuleMessage.ModuleMessageType.YellowWarning;
return false;
}
return true;
}
示例2: AddModuleMessage
/// -----------------------------------------------------------------------------
/// <summary>
/// AddModuleMessage adds a module message
/// </summary>
/// <param name="message">The message</param>
/// <param name="type">The type of message</param>
/// <history>
/// [cnurse] 08/24/2006
/// </history>
/// -----------------------------------------------------------------------------
private void AddModuleMessage(string message, ModuleMessage.ModuleMessageType type)
{
UI.Skins.Skin.AddModuleMessage(this, Localization.GetString(message, LocalResourceFile), type);
}
示例3: SendMailSynchronously
private void SendMailSynchronously(SendTokenizedBulkEmail email, out string strResult, out ModuleMessage.ModuleMessageType msgResult)
{
int mailsSent = email.SendMails();
if (mailsSent > 0)
{
strResult = string.Format(Localization.GetString("MessagesSentCount", LocalResourceFile), mailsSent);
msgResult = ModuleMessage.ModuleMessageType.GreenSuccess;
}
else
{
strResult = string.Format(Localization.GetString("NoMessagesSent", LocalResourceFile), email.SendingUser.Email);
msgResult = ModuleMessage.ModuleMessageType.YellowWarning;
}
}
示例4: PrepareEmail
private bool PrepareEmail(SendTokenizedBulkEmail email, ref string message, ref ModuleMessage.ModuleMessageType messageType)
{
bool isValid = true;
switch (teMessage.Mode)
{
case "RICH":
email.BodyFormat = MailFormat.Html;
break;
default:
email.BodyFormat = MailFormat.Text;
break;
}
switch (cboPriority.SelectedItem.Value)
{
case "1":
email.Priority = MailPriority.High;
break;
case "2":
email.Priority = MailPriority.Normal;
break;
case "3":
email.Priority = MailPriority.Low;
break;
default:
isValid = false;
break;
}
if (txtFrom.Text != string.Empty && email.SendingUser.Email != txtFrom.Text)
{
var myUser = email.SendingUser ?? new UserInfo();
myUser.Email = txtFrom.Text;
email.SendingUser = myUser;
}
if (txtReplyTo.Text != string.Empty && email.ReplyTo.Email != txtReplyTo.Text)
{
var myUser = new UserInfo { Email = txtReplyTo.Text };
email.ReplyTo = myUser;
}
if (selLanguage.Visible && selLanguage.SelectedLanguages != null)
{
email.LanguageFilter = selLanguage.SelectedLanguages;
}
if (ctlAttachment.Url.StartsWith("FileID="))
{
int fileId = int.Parse(ctlAttachment.Url.Substring(7));
var objFileInfo = FileManager.Instance.GetFile(fileId);
//TODO: support secure storage locations for attachments! [sleupold 06/15/2007]
email.AddAttachment(FileManager.Instance.GetFileContent(objFileInfo),
new ContentType { MediaType = objFileInfo.ContentType, Name = objFileInfo.FileName });
}
switch (cboSendMethod.SelectedItem.Value)
{
case "TO":
email.AddressMethod = SendTokenizedBulkEmail.AddressMethods.Send_TO;
break;
case "BCC":
email.AddressMethod = SendTokenizedBulkEmail.AddressMethods.Send_BCC;
break;
case "RELAY":
email.AddressMethod = SendTokenizedBulkEmail.AddressMethods.Send_Relay;
if (string.IsNullOrEmpty(txtRelayAddress.Text))
{
message = string.Format(Localization.GetString("MessagesSentCount", LocalResourceFile), -1);
messageType = ModuleMessage.ModuleMessageType.YellowWarning;
isValid = false;
}
else
{
email.RelayEmailAddress = txtRelayAddress.Text;
}
break;
}
email.SuppressTokenReplace = !chkReplaceTokens.Checked;
return isValid;
}
示例5: SendEmail
private void SendEmail(List<string> roleNames, List<UserInfo> users, ref string message, ref ModuleMessage.ModuleMessageType messageType)
{
//it is awkward to ensure that email is disposed correctly because when sent asynch it should be disposed by the asynch thread
var email = new SendTokenizedBulkEmail(roleNames, users, /*removeDuplicates*/ true, txtSubject.Text, ConvertToAbsoluteUrls(teMessage.Text));
bool isValid;
try
{
isValid = PrepareEmail(email, ref message, ref messageType);
}
catch (Exception)
{
email.Dispose();
throw;
}
if (isValid)
{
if (optSendAction.SelectedItem.Value == "S")
{
try
{
SendMailSynchronously(email, out message, out messageType);
}
finally
{
email.Dispose();
}
}
else
{
SendMailAsyncronously(email, out message, out messageType);
//dispose will be handled by async thread
}
}
}
示例6: SendMailAsyncronously
private void SendMailAsyncronously(SendTokenizedBulkEmail email, out string message, out ModuleMessage.ModuleMessageType messageType)
{
//First send off a test message
var strStartSubj = Localization.GetString("EMAIL_BulkMailStart_Subject.Text", Localization.GlobalResourceFile);
if (!string.IsNullOrEmpty(strStartSubj)) strStartSubj = string.Format(strStartSubj, txtSubject.Text);
var strStartBody = Localization.GetString("EMAIL_BulkMailStart_Body.Text", Localization.GlobalResourceFile);
if (!string.IsNullOrEmpty(strStartBody)) strStartBody = string.Format(strStartBody, txtSubject.Text, UserInfo.DisplayName, email.Recipients().Count);
var sendMailResult = Mail.SendMail(txtFrom.Text,
txtFrom.Text,
"",
"",
MailPriority.Normal,
strStartSubj,
MailFormat.Text,
Encoding.UTF8,
strStartBody,
"",
Host.SMTPServer,
Host.SMTPAuthentication,
Host.SMTPUsername,
Host.SMTPPassword,
Host.EnableSMTPSSL);
if (string.IsNullOrEmpty(sendMailResult))
{
var objThread = new Thread(() => SendAndDispose(email));
objThread.Start();
message = Localization.GetString("MessageSent", LocalResourceFile);
messageType = ModuleMessage.ModuleMessageType.GreenSuccess;
}
else
{
message = string.Format(Localization.GetString("NoMessagesSentPlusError", LocalResourceFile), sendMailResult);
messageType = ModuleMessage.ModuleMessageType.YellowWarning;
}
}
示例7: AddLocalizedModuleMessage
/// <summary>
/// AddLocalizedModuleMessage adds a localized module message
/// </summary>
/// <param name="message">The localized message</param>
/// <param name="type">The type of message</param>
/// <param name="display">A flag that determines whether the message should be displayed</param>
protected void AddLocalizedModuleMessage(string message, ModuleMessage.ModuleMessageType type, bool display)
{
if (display)
{
UI.Skins.Skin.AddModuleMessage(this, message, type);
}
}
示例8: AddModuleMessage
/// <summary>
/// AddModuleMessage adds a module message
/// </summary>
/// <param name="message">The message</param>
/// <param name="type">The type of message</param>
/// <param name="display">A flag that determines whether the message should be displayed</param>
protected void AddModuleMessage(string message, ModuleMessage.ModuleMessageType type, bool display)
{
AddLocalizedModuleMessage(Localization.GetString(message, LocalResourceFile), type, display);
}
示例9: GetModuleMessageControl
/// -----------------------------------------------------------------------------
/// <summary>
/// GetModuleMessageControl gets an existing Message Control and sets its properties
/// </summary>
/// <param name="heading">The Message Heading</param>
/// <param name="message">The Message Text</param>
/// <param name="moduleMessageType">The type of message</param>
/// <history>
/// [cnurse] 12/04/2007 documented
/// </history>
/// -----------------------------------------------------------------------------
public static ModuleMessage GetModuleMessageControl(string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType)
{
return GetModuleMessageControl(heading, message, moduleMessageType, Null.NullString);
}
示例10: AddPageMessage
/// -----------------------------------------------------------------------------
/// <summary>
/// AddPageMessage adds a Page Message control to the Skin
/// </summary>
/// <param name="heading">The Message Heading</param>
/// <param name="message">The Message Text</param>
/// <param name="page">The Page</param>
/// <param name="moduleMessageType">The type of the message</param>
/// <history>
/// [cnurse] 12/04/2007 documented
/// </history>
/// -----------------------------------------------------------------------------
public static void AddPageMessage(Page page, string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType)
{
AddPageMessage(page, heading, message, moduleMessageType, Null.NullString);
}
示例11: AddModuleMessage
/// -----------------------------------------------------------------------------
/// <summary>
/// AddModuleMessage adds a Moduel Message control to the Skin
/// </summary>
/// <param name="heading">The Message Heading</param>
/// <param name="message">The Message Text</param>
/// <param name="control">The current control</param>
/// <param name="moduleMessageType">The type of the message</param>
/// <history>
/// [cnurse] 12/04/2007 documented
/// </history>
/// -----------------------------------------------------------------------------
public static void AddModuleMessage(Control control, string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType)
{
AddModuleMessage(control, heading, message, moduleMessageType, Null.NullString);
}