Example #1
0
        public string DisplayValue(object value, Tk5FieldInfoEx field,
                                   IFieldValueProvider rowValue, string linkedValue)
        {
            if (rowValue == null)
            {
                return(linkedValue);
            }

            string linkUrl = ResolveRowValue(rowValue, Content);

            if (string.IsNullOrEmpty(linkUrl))
            {
                return(linkedValue);
            }
            else
            {
                linkUrl = AppUtil.ResolveUrl(linkUrl);
            }
            string target;

            if (!string.IsNullOrEmpty(Base))
            {
                linkUrl = UriUtil.CombineUri(Base, linkUrl).ToString();
            }
            if (!string.IsNullOrEmpty(Target))
            {
                target = string.Format(ObjectUtil.SysCulture, " target=\"{0}\"", Target);
            }
            else
            {
                target = string.Empty;
            }
            return(string.Format(ObjectUtil.SysCulture, "<a href=\"{0}\"{1}>{2}</a>",
                                 StringUtil.EscapeHtmlAttribute(linkUrl), target, StringUtil.EscapeHtml(linkedValue)));
        }
Example #2
0
        protected string LocalToUri()
        {
            if (string.IsNullOrEmpty(Base))
            {
                return(new Uri(Content).ToString());
            }

            return(UriUtil.CombineUri(Base, Content).ToString());
        }
Example #3
0
        public string ToUri(string content)
        {
            if (string.IsNullOrEmpty(Base))
            {
                return(new Uri(content).ToString());
            }

            return(UriUtil.CombineUri(Base, content).ToString());
        }
Example #4
0
        public string CreateVirtualPath()
        {
            Uri baseUri = BaseAppSetting.Current.VerfiyGetHost(BaseVirtualPath);

            if (string.IsNullOrEmpty(VirtualPath))
            {
                return(baseUri.ToString());
            }
            return(UriUtil.CombineUri(baseUri, VirtualPath).ToString());
        }
Example #5
0
        internal WeixinSettings(WeixinXml xml)
        {
            AppId         = xml.Weixin.AppId;
            LogRawMessage = xml.Weixin.LogRawMessage;
            WeixinPath    = Path.GetDirectoryName(xml.FullPath);
            UseLogOnRight = xml.Weixin.UseLogOnRight;

            WeixinNormalConfig normalConfig = xml.Weixin.Normal;

            if (normalConfig != null)
            {
                Mode              = WeixinMode.Normal;
                OpenId            = normalConfig.OpenId;
                fAppSecret        = normalConfig.Secret;
                fToken            = normalConfig.Token;
                MessageMode       = normalConfig.MessageMode;
                EncodingAESKey    = normalConfig.EncodingAESKey;
                fTemplateMessages = normalConfig.TemplateMessages;
                PaymentConfigItem pay = normalConfig.Pay;
                if (pay != null)
                {
                    fUsePay       = true;
                    fMchId        = pay.MchId;
                    fPayKey       = pay.Key;
                    fDeviceInfo   = pay.DeviceInfo;
                    fDeviceIp     = pay.DeviceIp;
                    fPayNotifyUrl = UriUtil.CombineUri(pay.NotifyBaseUrl, pay.NotifyUrl).ToString();
                }
                WeixinServiceConfigItem service = normalConfig.Service;
                if (service != null)
                {
                    fEnableService = service.Enabled;
                    fWeixinAccount = service.WeixinAccount;
                }
                else
                {
                    fEnableService = false;
                }

                if (MessageMode != MessageMode.Normal)
                {
                    TkDebug.AssertArgumentNullOrEmpty(EncodingAESKey,
                                                      "当消息是混合或者安全模式时,请配置EncodingAESKey的内容", xml);
                }
            }
            else if (xml.Weixin.CorpApps != null)
            {
                Mode      = WeixinMode.Corporation;
                fCorpApps = xml.Weixin.CorpApps;
                TkDebug.Assert(fCorpApps.Count > 0,
                               "至少需要配置一个tk:CorpApp节点", xml);
                CorpSecretConfig corpSecret = xml.Weixin.CorpSecret;
                TkDebug.AssertNotNull(corpSecret, "需要配置tk:CorpSecret节点", xml);
                fCorpUserManagerSecret = corpSecret.UserManager;
                fCorpMenuSecret        = corpSecret.Menu;
                if (string.IsNullOrEmpty(fCorpMenuSecret))
                {
                    fCorpMenuSecret = fCorpUserManagerSecret;
                }
                OpenId = AppId;
            }
            else
            {
                TkDebug.ThrowImpossibleCode(xml);
            }
            fCurrent = this;
        }