// 發送推播訊息 public async Task <PushMessage> PushAppMessage(PushMessage value) { var googleRespone = await SendPushMessageToGoogle(value); GoogleFCMResponseModel response = null; if (200.Equals(googleRespone._resultCode)) { try { response = JsonConvert.DeserializeObject <GoogleFCMResponseModel>(googleRespone._resultMsg); } catch (Exception ex) { ThrowCustomException.Exception550("", ex); } } else { string errMsg = "GoogleServer發生錯誤"; if (400.Equals(googleRespone._resultCode)) { ThrowCustomException.Exception451("JsonObject發生錯誤"); } else if (401.Equals(googleRespone._resultCode)) { ThrowCustomException.Exception453(); // ( Authorized不存在 ) } else { errMsg = googleRespone._resultMsg; } ThrowCustomException.Exception550(errMsg, null); } //紀錄推播結果 value = await RecordPushMessageResult(response, value); return(value); }
private bool VerifySearchDateRange(ref string dateStart, ref string dateEnd) { // true : 執行查詢時間區間 , false : 不執行 , ThrowException : 查詢條件錯誤 if (string.IsNullOrEmpty(dateStart) && string.IsNullOrEmpty(dateEnd)) { return(false); } if (!string.IsNullOrEmpty(dateStart) && !string.IsNullOrEmpty(dateEnd)) { } else { ThrowCustomException.Exception452("查詢時間起訖"); } if (dateStart.Length == 10 && dateEnd.Length == 10) { } //不做事 else { ThrowCustomException.Exception451("查詢時間"); } dateStart = MakeDateComplete(dateStart); dateEnd = MakeDateComplete(dateEnd); try { if (DateTime.Parse(dateStart) >= DateTime.Parse(dateEnd)) { ThrowCustomException.Exception451("查詢時間起訖"); } } catch { ThrowCustomException.Exception451("查詢時間"); } return(true); }