Example #1
0
        /// <summary>
        /// SMS_46780073 非正常开门 您好,您的朋友${uname}正在使用非正常指纹回家,请妥善处理!!!
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="mobile">手机</param>
        public void SendUnLockMsg(string name, string mobile)
        {
            String querys = string.Format("ParamString={0}&RecNum={1}&SignName={2}&TemplateCode=SMS_48945056", HttpUtility.UrlEncode("{\"uname\":\"" + name + "\"}", System.Text.Encoding.UTF8), mobile, HttpUtility.UrlEncode("艾力智能", System.Text.Encoding.UTF8));

            String url = "http://sms.market.alicloudapi.com/singleSendSms?" + querys;

            //ParamString%3d+%7b%22uname%22%3a%2213867911360%22%7d%26RecNum%3d13867911360%26SignName%3d%e8%89%be%e5%8a%9b%e9%9b%86%e6%88%90%26TemplateCode%3dSMS_46780073
            Crestron.SimplSharp.Net.Http.HttpClient client = new Crestron.SimplSharp.Net.Http.HttpClient();

            HttpClientRequest request = this.GetRequest(url);


            try
            {
                HttpClientResponse httpResponse = client.Dispatch(request);
                ILiveDebug.Instance.WriteLine("SMS:" + querys);
                httpResponse.Encoding = Encoding.UTF8;
                string html = httpResponse.ContentString;
                ILiveDebug.Instance.WriteLine(html);
            }
            catch (Exception ex)
            {
                ILiveDebug.Instance.WriteLine("ex:" + ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// 入侵提醒SMS_46695144 您的${zonemsg}有人非法入侵,请您确认!
        /// </summary>
        /// <param name="zongmsg">报警区域</param>
        /// <param name="mobile">手机</param>
        public void SendAlarmMsg(string zongmsg, string mobile)
        {
            String querys = string.Format("ParamString={0}&RecNum={1}&SignName={2}&TemplateCode=SMS_48575136", HttpUtility.UrlEncode("{\"zonemsg\":\"" + zongmsg + "\"}", System.Text.Encoding.UTF8), mobile, HttpUtility.UrlEncode("艾力智能", System.Text.Encoding.UTF8));
            String url    = "http://sms.market.alicloudapi.com/singleSendSms?" + querys;

            Crestron.SimplSharp.Net.Http.HttpClient client = new Crestron.SimplSharp.Net.Http.HttpClient();

            HttpClientRequest request = this.GetRequest(url);


            try
            {
                HttpClientResponse httpResponse = client.Dispatch(request);
                httpResponse.Encoding = Encoding.UTF8;
                string html = httpResponse.ContentString;
            }
            catch (Exception ex)
            {
                ILiveDebug.Instance.WriteLine("ex:" + ex.Message);
            }
        }
Example #3
0
        public void UpdateHost(string user, string pass, string host)
        {
            String querys = string.Format(url, host);

            Crestron.SimplSharp.Net.Http.HttpClient client = new Crestron.SimplSharp.Net.Http.HttpClient();

            string            auth    = "Basic " + Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(user + ":" + pass));
            HttpClientRequest request = this.GetRequest(querys, auth);


            try
            {
                ILiveDebug.Instance.WriteLine("ILiveOray:" + querys);
                HttpClientResponse httpResponse = client.Dispatch(request);
                httpResponse.Encoding = Encoding.UTF8;
                string html = httpResponse.ContentString;
                ILiveDebug.Instance.WriteLine(html);
            }
            catch (Exception ex)
            {
                ILiveDebug.Instance.WriteLine("ex:" + ex.Message);
            }
        }