public bool SendPhoneBaidu(BaseInfo baseInfo)
        {
            PhoneGCMInfo info = (PhoneGCMInfo)baseInfo;
            JSONInfo Info1 = new JSONInfo();
            subJSONInfo Info2 = new subJSONInfo();
            JSONResult Info3 = new JSONResult();
            ArrayList _GetPhoneRegIDData = new ArrayList();
            ArrayList _GetCarAlarmData = new ArrayList();
            ArrayList _GetRuleInfoData = new ArrayList();
            ArrayList _IOSRegIDData = new ArrayList();
            ArrayList _RegIDData = new ArrayList();

            _GetCarAlarmData.Add(info.DeviceID);
            IDataReader reader1 = DataProvider.Instance().ChkPhoneDriverInfoDB(_GetCarAlarmData);//FMS_PhoneDriverInfo_Fetch;return CarNo,Driver
            if (reader1.Read())
            {
                Info1.type = "alert";
                Info2.CarNo = reader1.GetString(0);
                Info2.Driver = reader1.GetString(1);
            }
            CBO.CloseDataReader(reader1, true);

            _GetRuleInfoData.Add(info.AlertRuleID);
            IDataReader reader2 = DataProvider.Instance().ChkPhoneRuleDB(_GetRuleInfoData);//FMS_PhoneRule_Fetch;return RuleName,AlarmType,Severity
            if (reader2.Read())
            {
                Info2.AlertDate = info.EventTime;
                Info2.RuleName = reader2.GetString(0);
                Info2.AlarmType = reader2.GetString(1);
                Info2.Severity = reader2.GetString(2);
            }
            CBO.CloseDataReader(reader2, true);


            Info1.data = new string[] { JsonConvert.SerializeObject(Info2) };
            string output = JsonConvert.SerializeObject(Info1);
            output = output.Replace("\\", "").Replace("[\"", "[").Replace("\"]", "]");



            _GetPhoneRegIDData.Add(info.AlertRuleID);
            _GetPhoneRegIDData.Add(info.DeviceID);
            IDataReader reader = DataProvider.Instance().GetBaiduDB(_GetPhoneRegIDData);//FMS_PhoneBaidu_Fetch;return UserId,RegisterID,Phone_Mail_Logic
            BaiduSender _BaiduPush = new BaiduSender();


            string strResultJson;
            while (reader.Read())
            {
                info.userID = reader.GetInt32(0).ToString();
                info.RegID = reader.GetString(1);
                Random rnd = new Random(Guid.NewGuid().GetHashCode());
                String msgKey = rnd.NextDouble() + "";
                strResultJson = _BaiduPush.Push(info.RegID, "", output, msgKey);

                //save log record
                CreatePushNoticeLog(info, output, "Baidu");

            }
            CBO.CloseDataReader(reader, true);

            return true;
        }
        public bool SendPhoneAPNS(BaseInfo baseInfo)
        {
            PhoneGCMInfo info = (PhoneGCMInfo)baseInfo;
            JSONInfo Info1 = new JSONInfo();
            subJSONInfo Info2 = new subJSONInfo();
            JSONResult Info3 = new JSONResult();
            ArrayList _GetPhoneRegIDData = new ArrayList();
            ArrayList _GetCarAlarmData = new ArrayList();
            ArrayList _GetRuleInfoData = new ArrayList();
            ArrayList _IOSRegIDData = new ArrayList();
            ArrayList _RegIDData = new ArrayList();

            _GetCarAlarmData.Add(info.DeviceID);
            IDataReader reader1 = DataProvider.Instance().ChkPhoneDriverInfoDB(_GetCarAlarmData);//FMS_PhoneDriverInfo_Fetch;return CarNo,Driver
            if (reader1.Read())
            {
                Info1.type = "check";
                Info2.CarNo = reader1.GetString(0);
                Info2.Driver = reader1.GetString(1);
            }
            CBO.CloseDataReader(reader1, true);

            _GetRuleInfoData.Add(info.AlertRuleID);
            IDataReader reader2 = DataProvider.Instance().ChkPhoneRuleDB(_GetRuleInfoData);//FMS_PhoneRule_Fetch;return RuleName,AlarmType,Severity
            if (reader2.Read())
            {
                Info2.AlertDate = info.EventTime;
                Info2.RuleName = reader2.GetString(0);
                Info2.AlarmType = reader2.GetString(1);
                Info2.Severity = reader2.GetString(2);
            }
            CBO.CloseDataReader(reader2, true);

            StringBuilder _sb = new StringBuilder();
            _sb.Append("警報日期:");
            _sb.Append(Info2.AlertDate);
            _sb.Append("\\n");
            _sb.Append("類型/嚴重度:");
            if (Info2.Severity.Equals("3"))
            {
                _sb.Append(Info2.AlarmType + " / [嚴重]");
            }
            else if (Info2.Severity.Equals("2"))
            {
                _sb.Append(Info2.AlarmType + " / [一般]");
            }
            else
            {
                _sb.Append(Info2.AlarmType + " / [輕度]");
            }
            _sb.Append("\\n");
            _sb.Append("名稱:");
            _sb.Append(Info2.RuleName);
            _sb.Append("\\n");
            _sb.Append("車號/駕駛人:");
            _sb.Append(Info2.CarNo + " / " + Info2.Driver);

            string output = _sb.ToString();


            //  string output = "警報日期:2015/03/04 11:55:00 \\n類型/嚴重度:超速 / [嚴重]\\n名稱:連續超速70km  3分鐘\\n車號/駕駛人:kw-car03 / 易大師";


            _GetPhoneRegIDData.Add(info.AlertRuleID);
            _GetPhoneRegIDData.Add(info.DeviceID);
            IDataReader reader = DataProvider.Instance().GetAPNSDB(_GetPhoneRegIDData);//FMS_PhoneGCM_Fetch;return UserId,RegisterID,Phone_Mail_Logic
            APNSSender _apnsSender = new APNSSender();

            string strResultJson;
            while (reader.Read())
            {
                info.userID = reader.GetInt32(0).ToString();
                info.RegID = reader.GetString(1);
                strResultJson = _apnsSender.SendAPNS(info.RegID, output);
                //save log record
                CreatePushNoticeLog(info, output, "Apple");
            }
            CBO.CloseDataReader(reader, true);

            return true;
        }