Example #1
0
            public static IDictionary GetDictionary(SiteInfo siteInfo, int channelId)
            {
                var dictionary = new ListDictionary
                {
                    { ChannelId, "栏目ID" },
                    { Year, "年份" },
                    { Month, "月份" },
                    { Day, "日期" },
                    { Hour, "小时" },
                    { Minute, "分钟" },
                    { Second, "秒钟" },
                    { Sequence, "顺序数" },
                    { ParentRule, "父级命名规则" },
                    { ChannelName, "栏目名称" },
                    { LowerChannelName, "栏目名称(小写)" },
                    { ChannelIndex, "栏目索引" },
                    { LowerChannelIndex, "栏目索引(小写)" }
                };

                var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(siteInfo.Id, channelId);

                var styleInfoList = TableStyleManager.GetTableStyleInfoList(DataProvider.ChannelDao.TableName, relatedIdentities);

                foreach (var styleInfo in styleInfoList)
                {
                    if (styleInfo.InputType == InputType.Text)
                    {
                        dictionary.Add($@"{{@{StringUtils.LowerFirst(styleInfo.AttributeName)}}}", styleInfo.DisplayName);
                        dictionary.Add($@"{{@lower{styleInfo.AttributeName}}}", styleInfo.DisplayName + "(小写)");
                    }
                }

                return(dictionary);
            }
Example #2
0
            public static IDictionary GetDictionary(PublishmentSystemInfo publishmentSystemInfo, int nodeId)
            {
                var dictionary = new ListDictionary
                {
                    { ChannelId, "栏目ID" },
                    { ChannelIndex, "栏目索引" },
                    { Year, "年份" },
                    { Month, "月份" },
                    { Day, "日期" },
                    { Hour, "小时" },
                    { Minute, "分钟" },
                    { Second, "秒钟" },
                    { Sequence, "顺序数" },
                    { ParentRule, "父级命名规则" },
                    { ChannelName, "栏目名称" }
                };

                //继承父级设置 20151113 sessionliang

                var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeId);

                var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.Channel, DataProvider.NodeDao.TableName, relatedIdentities);

                foreach (var styleInfo in styleInfoList)
                {
                    if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Text))
                    {
                        dictionary.Add($@"{{@{styleInfo.AttributeName}}}", styleInfo.DisplayName);
                    }
                }

                return(dictionary);
            }
Example #3
0
        public static void SendSMS(PublishmentSystemInfo publishmentSystemInfo, ITagStyleMailSMSBaseInfo mailSMSInfo, ETableStyle tableStyle, string tableName, int relatedIdentity, ExtendedAttributes contentInfo)
        {
            try
            {
                if (mailSMSInfo.IsSMS)
                {
                    var styleInfoList = RelatedIdentities.GetTableStyleInfoList(publishmentSystemInfo, tableStyle, relatedIdentity);

                    var smsToArrayList = new ArrayList();
                    if (mailSMSInfo.SMSReceiver == ETriState.All || mailSMSInfo.SMSReceiver == ETriState.True)
                    {
                        if (!string.IsNullOrEmpty(mailSMSInfo.SMSTo))
                        {
                            var mobiles = mailSMSInfo.SMSTo.Split(';', ',');
                            foreach (var mobile in mobiles)
                            {
                                if (!string.IsNullOrEmpty(mobile) && StringUtils.IsMobile(mobile) && !smsToArrayList.Contains(mobile))
                                {
                                    smsToArrayList.Add(mobile);
                                }
                            }
                        }
                    }
                    if (mailSMSInfo.SMSReceiver == ETriState.All || mailSMSInfo.SMSReceiver == ETriState.False)
                    {
                        var smsTo = contentInfo.GetExtendedAttribute(mailSMSInfo.SMSFiledName);
                        if (!string.IsNullOrEmpty(smsTo))
                        {
                            var mobiles = smsTo.Split(';', ',');
                            foreach (var mobile in mobiles)
                            {
                                if (!string.IsNullOrEmpty(mobile) && StringUtils.IsMobile(mobile) && !smsToArrayList.Contains(mobile))
                                {
                                    smsToArrayList.Add(mobile);
                                }
                            }
                        }
                    }

                    var builder = new StringBuilder();

                    if (mailSMSInfo.IsSMSTemplate && !string.IsNullOrEmpty(mailSMSInfo.SMSContent))
                    {
                        builder.Append(mailSMSInfo.SMSContent);
                    }
                    else
                    {
                        builder.Append(GetSMSContent(styleInfoList));
                    }

                    var content = builder.ToString();
                    content = StringUtils.ReplaceIgnoreCase(content, "[AddDate]", DateUtils.GetDateAndTimeString(TranslateUtils.ToDateTime(contentInfo.GetExtendedAttribute(ContentAttribute.AddDate))));

                    foreach (var styleInfo in styleInfoList)
                    {
                        var theValue = InputParserUtility.GetContentByTableStyle(contentInfo.GetExtendedAttribute(styleInfo.AttributeName), publishmentSystemInfo, tableStyle, styleInfo);
                        content = StringUtils.ReplaceIgnoreCase(content, $"[{styleInfo.AttributeName}]", theValue);
                    }

                    var attributeNameList = TableManager.GetAttributeNameList(tableStyle, tableName);
                    foreach (string attributeName in attributeNameList)
                    {
                        var theValue = contentInfo.GetExtendedAttribute(attributeName);
                        content = StringUtils.ReplaceIgnoreCase(content, $"[{attributeName}]", theValue);
                    }

                    if (content.Length > 60)
                    {
                        content = content.Substring(0, 60);
                    }

                    //var errorMessage = string.Empty;
                    //var providerInfo = BaiRongDataProvider.SmsProviderDAO.GetFirstSmsProviderInfo();
                    //if (providerInfo != null)
                    //{
                    //    SmsProviderManager.Send(providerInfo, smsToArrayList, content, out errorMessage);
                    //}
                }
            }
            catch
            {
                // ignored
            }
        }