Ejemplo n.º 1
0
		// Show Alert Result TalkNow Request
		public static MAlertDTO getMessageTalkRequest (TalkNowDTO talkDto)
		{
			MAlertDTO alertDTO = new MAlertDTO ();
			alertDTO.isDelegate = false;

			if (talkDto.status == CoreSystem.Constants.TALK_REQUEST_STATUS.BalanceIsExpire) {
				alertDTO.title = TCLocalizabled.getText ("AlertTitleConsultationTalkNow");
				alertDTO.message = TCLocalizabled.getText ("AlertMessageTalkRequestBalanceNotEnough");
			} else if (talkDto.status == CoreSystem.Constants.TALK_REQUEST_STATUS.CallInProgress) {
				alertDTO.title = TCLocalizabled.getText ("AlertTitleConsultationTalkNow");
				alertDTO.message = TCLocalizabled.getText ("AlertMessageTalkRequestInConversation");
			} else if (talkDto.status == CoreSystem.Constants.TALK_REQUEST_STATUS.BookingCanceled) {
				alertDTO.isDelegate = true;
				alertDTO.title = TCLocalizabled.getText ("AlertTitleConsultationTalkNow");
				alertDTO.message = TCLocalizabled.getText ("AlertMessageTalkRequestBookingCanceled");
			} else if (talkDto.status == CoreSystem.Constants.TALK_REQUEST_STATUS.CallServiceUnavailable) {
				alertDTO.title = TCLocalizabled.getText ("AlertTitleConsultationTalkNow");
				alertDTO.message = TCLocalizabled.getText ("AlertMessageTalkRequestCallServiceUnavailable");
			} else if (talkDto.status == CoreSystem.Constants.TALK_REQUEST_STATUS.SystemError) {
				alertDTO.title = TCLocalizabled.getText ("TitleAlert");
				alertDTO.message = TCLocalizabled.getText ("TextRequestFail");
			} else {
				alertDTO = null;
			}

			return alertDTO;
		}
Ejemplo n.º 2
0
		public static TalkNowDTO parseDataTalkNow (string response)
		{
			TalkNowDTO talkDto = new TalkNowDTO ();
			try {
				Dictionary<string, object> result = JsonConvert.DeserializeObject<Dictionary<string, object>> (response);
				if (result.ContainsKey ("Success")) {
					talkDto.success = bool.Parse(result ["Success"].ToString());
				} 

				if (result.ContainsKey ("Error")) {
					talkDto.status =  (Constants.TALK_REQUEST_STATUS)Enum.ToObject(typeof(Constants.TALK_REQUEST_STATUS), int.Parse(result ["Error"].ToString()));
				} else {
					talkDto.status = Constants.TALK_REQUEST_STATUS.None;
				}
			} catch (Exception ex) {
				#if DEBUG
				Console.Write(ex.Message);
				#endif
				return new TalkNowDTO();
			}

			return talkDto;
		}