Пример #1
0
        /// <summary>
        /// SetSession
        /// </summary>
        /// <param name="context"></param>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public static void SetSession(HttpContext context, string key, byte[] value)
        {
            key = AppConfigurtaionServices.GetAppSettingsString("SystemPreFix") + key;

            context.Session.Remove(key);
            context.Session.Set(key, value);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static object GetCache(string key)
        {
            key = AppConfigurtaionServices.GetAppSettingsString("SystemPreFix") + key;

            var exists = _cache.TryGetValue(key, out object value);

            if (!exists)
            {
                return(null);
            }

            return(value);
        }
Пример #3
0
        private static bool Read_IsCloseMethod_Shove_FilteSqlInfusion()
        {
            bool   result = false;
            string str    = AppConfigurtaionServices.GetAppSettingsString("IsCloseMethod_Shove_FilteSqlInfusion");

            if (string.IsNullOrEmpty(str))
            {
                str = "false";
            }

            Boolean.TryParse(str, out result);

            return(result);
        }
Пример #4
0
        /// <summary>
        /// 工信部实时域名备案状态查询(通过英迈思的备案系统接口)
        /// </summary>
        /// <param name="domainName"></param>
        /// <returns></returns>
        public static string IcpBeianQueryRealTime(string domainName)
        {
            var binding = new BasicHttpBinding();

            binding.MaxReceivedMessageSize = 2147483647;
            var endpoint = new EndpointAddress(AppConfigurtaionServices.GetAppSettingsString("Icp_GatewayServiceUrl"));

            var service = new GatewaySoapClient(binding, endpoint);
            var v       = service.IcpBeianQueryRealTimeAsync("eimslab", domainName);

            v.Wait();

            return(v.Result.Body.IcpBeianQueryRealTimeResult);
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="cacheSeconds"></param>
        public static void SetCache(string key, object value, int cacheSeconds)
        {
            key = AppConfigurtaionServices.GetAppSettingsString("SystemPreFix") + key;

            RemoveCache(key);

            if (cacheSeconds <= 0)
            {
                return;
            }

            var entry = _cache.CreateEntry(key);

            entry.Value = value;
            entry.SetAbsoluteExpiration(DateTime.Now.AddSeconds(cacheSeconds));
        }
Пример #6
0
        /// <summary>
        /// 查询短信账户余额。如果 App.Config 或者 Web.Config 的 AppSetting 中没有 Key="I3kmSMS_GatewayServiceUrl" value="" 的设置,将使用默认的网关地址。
        /// </summary>
        /// <param name="regCode"></param>
        /// <param name="regKey"></param>
        /// <returns></returns>
        public static ArrayOfXElement GetBalance(string regCode, string regKey)
        {
            var binding = new BasicHttpBinding();

            binding.MaxReceivedMessageSize = 2147483647;
            var endpoint = new EndpointAddress(AppConfigurtaionServices.GetAppSettingsString("I3kmSMS_GatewayServiceUrl"));

            var      service   = new sms_gatewaySoapClient(binding, endpoint);
            DateTime TimeStamp = DateTime.Now;
            string   sign      = Shove.Security.Encrypt.MD5(regCode + TimeStamp.ToString() + regKey);
            var      v         = service.QueryBalanceAsync(regCode, TimeStamp.ToString(), sign);

            v.Wait();

            return(v.Result);
        }
Пример #7
0
        /// <summary>
        /// 发送短信。如果 App.Config 或者 Web.Config 的 AppSetting 中没有 Key="I3kmSMS_GatewayServiceUrl" value="" 的设置,将使用默认的网关地址。
        /// </summary>
        /// <param name="regCode"></param>
        /// <param name="regKey"></param>
        /// <param name="content"></param>
        /// <param name="to"></param>
        /// <param name="sendTime">指定的发送时间,可以实现按指定的发送时间再进行发送的功能</param>
        /// <returns></returns>
        public static ArrayOfXElement SendSMS(string regCode, string regKey, string content, string to, DateTime sendTime)
        {
            var binding = new BasicHttpBinding();

            binding.MaxReceivedMessageSize = 2147483647;
            var endpoint = new EndpointAddress(AppConfigurtaionServices.GetAppSettingsString("I3kmSMS_GatewayServiceUrl"));

            var      service   = new sms_gatewaySoapClient(binding, endpoint);
            DateTime timeStamp = DateTime.Now;
            string   sign      = Shove.Security.Encrypt.MD5(regCode + timeStamp.ToString() + content + to + sendTime.ToString("yyyyMMdd HHmmss") + regKey);
            var      v         = service.SendSMS_2Async(regCode, timeStamp.ToString(), sign, content, to, sendTime);

            v.Wait();

            return(v.Result);
        }
Пример #8
0
        /// <summary>
        /// GetSession
        /// </summary>
        /// <param name="context"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static byte[] GetSession(HttpContext context, string key)
        {
            key = AppConfigurtaionServices.GetAppSettingsString("SystemPreFix") + key;

            if (context.Session.TryGetValue(key, out byte[] r))
Пример #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        public static void RemoveCache(string key)
        {
            key = AppConfigurtaionServices.GetAppSettingsString("SystemPreFix") + key;

            _cache.Remove(key);
        }