internal static MessageTemplate GetTemplate(string messageType)
        {
            messageType = messageType.ToLower();
            SiteSettings siteSettings = HiContext.Current.SiteSettings;
            string       string_;

            if (siteSettings.IsDistributorSettings)
            {
                string_ = string.Format("Message-{0}-{1}", siteSettings.UserId.Value.ToString(System.Globalization.CultureInfo.InvariantCulture), messageType);
            }
            else
            {
                string_ = string.Format("Message-{0}", messageType);
            }
            MessageTemplate messageTemplate = HiCache.Get(string_) as MessageTemplate;

            if (messageTemplate == null)
            {
                messageTemplate = (siteSettings.IsDistributorSettings ? MessageTemplateHelper.GetDistributorMessageTemplate(messageType, siteSettings.UserId.Value) : MessageTemplateHelper.GetMessageTemplate(messageType));
                if (messageTemplate != null)
                {
                    HiCache.Max(string_, messageTemplate);
                }
            }
            return(messageTemplate);
        }
        public static IList <MessageTemplate> GetWxAppletMessageTemplates()
        {
            IList <MessageTemplate> messageTemplates = MessageTemplateHelper.GetMessageTemplates();

            return((from t in messageTemplates
                    where t.UseInWxApplet
                    select t).ToList());
        }
        public static IList <MessageTemplate> GetWxMessageTemplates()
        {
            IList <MessageTemplate> messageTemplates = MessageTemplateHelper.GetMessageTemplates();

            return((from t in messageTemplates
                    where t.WeixinTemplateNo.ToNullString() != ""
                    select t).ToList());
        }
Beispiel #4
0
        private static MailMessage GenericOrderEmail(MessageTemplate template, SiteSettings settings, string UserName, string userEmail, string orderId, decimal total, string memo, string shippingType, string shippingName, string shippingAddress, string shippingZip, string shippingPhone, string shippingCell, string shippingEmail, string shippingBillno, decimal refundMoney, string closeReason)
        {
            MailMessage emailTemplate = MessageTemplateHelper.GetEmailTemplate(template, userEmail);

            if (emailTemplate == null)
            {
                return(null);
            }
            emailTemplate.Subject = GenericOrderMessageFormatter(settings, UserName, emailTemplate.Subject, orderId, total, memo, shippingType, shippingName, shippingAddress, shippingZip, shippingPhone, shippingCell, shippingEmail, shippingBillno, refundMoney, closeReason);
            emailTemplate.Body    = GenericOrderMessageFormatter(settings, UserName, emailTemplate.Body, orderId, total, memo, shippingType, shippingName, shippingAddress, shippingZip, shippingPhone, shippingCell, shippingEmail, shippingBillno, refundMoney, closeReason);
            return(emailTemplate);
        }
Beispiel #5
0
        private static MailMessage GenericUserEmail(MessageTemplate template, SiteSettings settings, string UserName, string userEmail, string password, string dealPassword)
        {
            MailMessage emailTemplate = MessageTemplateHelper.GetEmailTemplate(template, userEmail);

            if (emailTemplate == null)
            {
                return(null);
            }
            emailTemplate.Subject = GenericUserMessageFormatter(settings, emailTemplate.Subject, UserName, userEmail, password, dealPassword);
            emailTemplate.Body    = GenericUserMessageFormatter(settings, emailTemplate.Body, UserName, userEmail, password, dealPassword);
            return(emailTemplate);
        }
        public static MessageTemplate GetMessageTemplate(string messageType)
        {
            if (string.IsNullOrEmpty(messageType))
            {
                return(null);
            }
            IList <MessageTemplate> messageTemplates = MessageTemplateHelper.GetMessageTemplates();

            return((from t in messageTemplates
                    where t.MessageType.ToLower() == messageType.ToLower()
                    select t).FirstOrDefault());
        }
Beispiel #7
0
 private static System.Net.Mail.MailMessage GenericUserEmail(MessageTemplate template, SiteSettings settings, string username, string userEmail, string password, string dealPassword)
 {
     System.Net.Mail.MailMessage emailTemplate = MessageTemplateHelper.GetEmailTemplate(template, userEmail);
     System.Net.Mail.MailMessage result;
     if (emailTemplate == null)
     {
         result = null;
     }
     else
     {
         emailTemplate.Subject = Messenger.GenericUserMessageFormatter(settings, emailTemplate.Subject, username, userEmail, password, dealPassword);
         emailTemplate.Body    = Messenger.GenericUserMessageFormatter(settings, emailTemplate.Body, username, userEmail, password, dealPassword);
         result = emailTemplate;
     }
     return(result);
 }
        internal static MessageTemplate GetTemplate(string messageType)
        {
            SiteSettings    masterSettings  = SettingsManager.GetMasterSettings();
            string          key             = $"DataCache-MessageTemplate-{messageType.ToLower()}";
            MessageTemplate messageTemplate = HiCache.Get <MessageTemplate>(key);

            if (messageTemplate == null)
            {
                messageTemplate = MessageTemplateHelper.GetMessageTemplate(messageType);
                if (messageTemplate != null)
                {
                    HiCache.Insert(key, messageTemplate, 1800);
                }
            }
            return(messageTemplate);
        }
Beispiel #9
0
 private static System.Net.Mail.MailMessage GenericOrderEmail(MessageTemplate template, SiteSettings settings, string username, string userEmail, string orderId, decimal total, string memo, string shippingType, string shippingName, string shippingAddress, string shippingZip, string shippingPhone, string shippingCell, string shippingEmail, string shippingBillno, decimal refundMoney, string closeReason)
 {
     System.Net.Mail.MailMessage emailTemplate = MessageTemplateHelper.GetEmailTemplate(template, userEmail);
     System.Net.Mail.MailMessage result;
     if (emailTemplate == null)
     {
         result = null;
     }
     else
     {
         emailTemplate.Subject = Messenger.GenericOrderMessageFormatter(settings, username, emailTemplate.Subject, orderId, total, memo, shippingType, shippingName, shippingAddress, shippingZip, shippingPhone, shippingCell, shippingEmail, shippingBillno, refundMoney, closeReason);
         emailTemplate.Body    = Messenger.GenericOrderMessageFormatter(settings, username, emailTemplate.Body, orderId, total, memo, shippingType, shippingName, shippingAddress, shippingZip, shippingPhone, shippingCell, shippingEmail, shippingBillno, refundMoney, closeReason);
         result = emailTemplate;
     }
     return(result);
 }
        internal static MessageTemplate GetTemplate(string messageType)
        {
            messageType = messageType.ToLower();
            SiteSettings    masterSettings  = SettingsManager.GetMasterSettings(false);
            string          key             = string.Format("Message-{0}", messageType);
            MessageTemplate messageTemplate = HiCache.Get(key) as MessageTemplate;

            if (messageTemplate == null)
            {
                messageTemplate = MessageTemplateHelper.GetMessageTemplate(messageType);
                if (messageTemplate != null)
                {
                    HiCache.Max(key, messageTemplate);
                }
            }
            return(messageTemplate);
        }
Beispiel #11
0
 public static void UserRegister(MemberInfo user, string createPassword, string wid)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("NewUserAccountCreated", wid);
         if (template != null)
         {
             MailMessage  email          = null;
             string       innerSubject   = null;
             string       innerMessage   = null;
             string       smsMessage     = null;
             SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid);
             GenericUserMessages(masterSettings, user.UserName, user.Email, createPassword, null, template, out email, out smsMessage, out innerSubject, out innerMessage);
             Send(template, masterSettings, user, true, email, innerSubject, innerMessage, smsMessage, null);
         }
     }
 }
Beispiel #12
0
 public static void DistributorRegister(DistributorsInfo duser, MemberInfo user, string gradeinfoName, string wid)
 {
     if (duser != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("BecomeDistributor", wid);
         if (template != null)
         {
             MailMessage     email           = null;
             string          innerSubject    = null;
             string          innerMessage    = null;
             string          smsMessage      = null;
             SiteSettings    masterSettings  = SettingsManager.GetMasterSettings(false, wid);
             TemplateMessage templateMessage = GenerateWeixinMessageWhenDistributorReg(template.WeixinTemplateId, masterSettings, duser, user.OpenId, gradeinfoName);
             Send(template, masterSettings, user, false, email, innerSubject, innerMessage, smsMessage, templateMessage);
         }
     }
 }
Beispiel #13
0
 public static void OrderRefund(IUser user, string orderId, decimal amount)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("OrderRefund");
         if (template != null)
         {
             MailMessage  email        = null;
             string       innerSubject = null;
             string       innerMessage = null;
             string       smsMessage   = null;
             SiteSettings siteSettings = HiContext.Current.SiteSettings;
             GenericOrderMessages(siteSettings, user.Username, user.Email, orderId, 0M, null, null, null, null, null, null, null, null, null, amount, null, template, out email, out smsMessage, out innerSubject, out innerMessage);
             Send(template, siteSettings, user, false, email, innerSubject, innerMessage, smsMessage);
         }
     }
 }
Beispiel #14
0
 public static void UserRegister(IUser user, string createPassword)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("NewUserAccountCreated");
         if (template != null)
         {
             MailMessage  email        = null;
             string       innerSubject = null;
             string       innerMessage = null;
             string       smsMessage   = null;
             SiteSettings siteSettings = HiContext.Current.SiteSettings;
             GenericUserMessages(siteSettings, user.Username, user.Email, createPassword, null, template, out email, out smsMessage, out innerSubject, out innerMessage);
             Send(template, siteSettings, user, true, email, innerSubject, innerMessage, smsMessage);
         }
     }
 }
Beispiel #15
0
 public static void AcceptRequest(IUser user)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("AcceptDistributorRequest");
         if (template != null)
         {
             System.Net.Mail.MailMessage email = null;
             string       innerSubject         = null;
             string       innerMessage         = null;
             string       smsMessage           = null;
             SiteSettings siteSettings         = HiContext.Current.SiteSettings;
             Messenger.GenericUserMessages(siteSettings, user.Username, user.Email, null, null, template, out email, out smsMessage, out innerSubject, out innerMessage);
             Messenger.Send(template, siteSettings, user, true, email, innerSubject, innerMessage, smsMessage);
         }
     }
 }
Beispiel #16
0
 public static void OrderClosed(IUser user, string orderId, string reason)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("OrderClosed");
         if (template != null)
         {
             System.Net.Mail.MailMessage email = null;
             string       innerSubject         = null;
             string       innerMessage         = null;
             string       smsMessage           = null;
             SiteSettings siteSettings         = HiContext.Current.SiteSettings;
             Messenger.GenericOrderMessages(siteSettings, user.Username, user.Email, orderId, 0m, null, null, null, null, null, null, null, null, null, 0m, reason, template, out email, out smsMessage, out innerSubject, out innerMessage);
             Messenger.Send(template, siteSettings, user, false, email, innerSubject, innerMessage, smsMessage);
         }
     }
 }
Beispiel #17
0
 public static void OrderShipping(OrderInfo order, IUser user)
 {
     if (order != null && user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("OrderShipping");
         if (template != null)
         {
             System.Net.Mail.MailMessage email = null;
             string       innerSubject         = null;
             string       innerMessage         = null;
             string       smsMessage           = null;
             SiteSettings siteSettings         = HiContext.Current.SiteSettings;
             Messenger.GenericOrderMessages(siteSettings, user.Username, user.Email, order.OrderId, order.GetTotal(), order.Remark, order.RealModeName, order.ShipTo, order.Address, order.ZipCode, order.TelPhone, order.CellPhone, order.EmailAddress, order.ShipOrderNumber, order.RefundAmount, order.CloseReason, template, out email, out smsMessage, out innerSubject, out innerMessage);
             Messenger.Send(template, siteSettings, user, false, email, innerSubject, innerMessage, smsMessage);
         }
     }
 }
Beispiel #18
0
 public static void UserDealPasswordChanged(IUser user, string changedDealPassword)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("ChangedDealPassword");
         if (template != null)
         {
             System.Net.Mail.MailMessage email = null;
             string       innerSubject         = null;
             string       innerMessage         = null;
             string       smsMessage           = null;
             SiteSettings siteSettings         = HiContext.Current.SiteSettings;
             Messenger.GenericUserMessages(siteSettings, user.Username, user.Email, null, changedDealPassword, template, out email, out smsMessage, out innerSubject, out innerMessage);
             Messenger.Send(template, siteSettings, user, false, email, innerSubject, innerMessage, smsMessage);
         }
     }
 }
Beispiel #19
0
 public static void UserPasswordForgotten(IUser user, string resetPassword)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("ForgottenPassword");
         if (template != null)
         {
             System.Net.Mail.MailMessage email = null;
             string       innerSubject         = null;
             string       innerMessage         = null;
             string       smsMessage           = null;
             SiteSettings siteSettings         = HiContext.Current.SiteSettings;
             Messenger.GenericUserMessages(siteSettings, user.Username, user.Email, resetPassword, null, template, out email, out smsMessage, out innerSubject, out innerMessage);
             Messenger.Send(template, siteSettings, user, true, email, innerSubject, innerMessage, smsMessage);
         }
     }
 }
Beispiel #20
0
 public static void OrderClosed(MemberInfo user, OrderInfo order, string reason)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("OrderClosed");
         if (template != null)
         {
             MailMessage  email          = null;
             string       innerSubject   = null;
             string       innerMessage   = null;
             string       smsMessage     = null;
             SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
             GenericOrderMessages(masterSettings, user.UserName, user.Email, order.OrderId, 0M, null, null, null, null, null, null, null, null, null, 0M, reason, template, out email, out smsMessage, out innerSubject, out innerMessage);
             TemplateMessage templateMessage = GenerateWeixinMessageWhenOrderClose(template.WeixinTemplateId, masterSettings, user, order, reason);
             Send(template, masterSettings, user, false, email, innerSubject, innerMessage, smsMessage, templateMessage);
         }
     }
 }
Beispiel #21
0
 public static void UserPasswordForgotten(MemberInfo user, string resetPassword, string wid)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("ForgottenPassword", wid);
         if (template != null)
         {
             MailMessage  email          = null;
             string       innerSubject   = null;
             string       innerMessage   = null;
             string       smsMessage     = null;
             SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid);
             GenericUserMessages(masterSettings, user.UserName, user.Email, resetPassword, null, template, out email, out smsMessage, out innerSubject, out innerMessage);
             TemplateMessage templateMessage = GenerateWeixinMessageWhenFindPassword(template.WeixinTemplateId, masterSettings, user, resetPassword);
             Send(template, masterSettings, user, true, email, innerSubject, innerMessage, smsMessage, templateMessage);
         }
     }
 }
Beispiel #22
0
 public static void UserDealPasswordChanged(MemberInfo user, string changedDealPassword, string wid)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("ChangedDealPassword", wid);
         if (template != null)
         {
             MailMessage  email          = null;
             string       innerSubject   = null;
             string       innerMessage   = null;
             string       smsMessage     = null;
             SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid);
             GenericUserMessages(masterSettings, user.UserName, user.Email, null, changedDealPassword, template, out email, out smsMessage, out innerSubject, out innerMessage);
             TemplateMessage templateMessage = GenerateWeixinMessageWhenPasswordChange(template.WeixinTemplateId, masterSettings, user, "交易");
             Send(template, masterSettings, user, false, email, innerSubject, innerMessage, smsMessage, templateMessage);
         }
     }
 }
Beispiel #23
0
 public static void OrderShipping(OrderInfo order, MemberInfo user, string wid)
 {
     if ((order != null) && (user != null))
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("OrderShipping", wid);
         if (template != null)
         {
             MailMessage  email          = null;
             string       innerSubject   = null;
             string       innerMessage   = null;
             string       smsMessage     = null;
             SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid);
             GenericOrderMessages(masterSettings, user.UserName, user.Email, order.OrderId, order.GetTotal(), order.Remark, order.RealModeName, order.ShipTo, order.Address, order.ZipCode, order.TelPhone, order.CellPhone, order.EmailAddress, order.ShipOrderNumber, order.RefundAmount, order.CloseReason, template, out email, out smsMessage, out innerSubject, out innerMessage);
             TemplateMessage templateMessage = GenerateWeixinMessageWhenOrderSend(template.WeixinTemplateId, masterSettings, user, order);
             Send(template, masterSettings, user, false, email, innerSubject, innerMessage, smsMessage, templateMessage);
         }
     }
 }
Beispiel #24
0
 public static void OrderRefund(MemberInfo user, string orderId, decimal amount, string wid)
 {
     if (user != null)
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("OrderRefund", wid);
         if (template != null)
         {
             MailMessage  email          = null;
             string       innerSubject   = null;
             string       innerMessage   = null;
             string       smsMessage     = null;
             SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid);
             GenericOrderMessages(masterSettings, user.UserName, user.Email, orderId, 0M, null, null, null, null, null, null, null, null, null, amount, null, template, out email, out smsMessage, out innerSubject, out innerMessage);
             TemplateMessage templateMessage = GenerateWeixinMessageWhenOrderRefund(template.WeixinTemplateId, masterSettings, user, orderId, amount);
             Send(template, masterSettings, user, false, email, innerSubject, innerMessage, smsMessage, templateMessage);
         }
     }
 }