Exemple #1
0
        /// <summary>
        /// 查询短信账户余额。如果 App.Config 或者 Web.Config 的 AppSetting 中没有 Key="I3kmSMS_GatewayServiceUrl" value="" 的设置,将使用默认的网关地址。
        /// </summary>
        /// <param name="RegCode"></param>
        /// <param name="RegKey"></param>
        /// <returns></returns>
        public static DataSet GetBalance(string RegCode, string RegKey)
        {
            I3kmSMS_GatewayService.sms_gateway service = null;

            try
            {
                service = new I3kmSMS_GatewayService.sms_gateway();
                string url = System.Configuration.ConfigurationManager.AppSettings["I3kmSMS_GatewayServiceUrl"];

                if (!String.IsNullOrEmpty(url))
                {
                    service.Url = url;
                }
            }
            catch
            {
                service.Dispose();

                return(null);
            }

            DateTime TimeStamp = DateTime.Now;

            string  Sign = Shove._Security.Encrypt.MD5(RegCode + TimeStamp.ToString() + RegKey);
            DataSet ds   = null;

            try
            {
                ds = service.QueryBalance(RegCode, TimeStamp.ToString(), Sign);
            }
            catch
            {
                service.Dispose();

                return(null);
            }

            service.Dispose();

            return(ds);
        }