private async void SendButtonOnClick(object sender, EventArgs e) { if (_messageText.Text == "") { await AlertDialogHelper.ShowAsync(Activity, "Atención", "Para enviar el mensaje con éxito, es necesario llenar todos los campos.", "OK", ""); return; } _sendButton.Activated = false; IInboxProxy inboxProxy = BasicProxiesFactory.GetInboxProxy(); Tuple <int, string> truckInfo = GetTruckId(); Common.ReportTypesEnum reportType = GetReportType(); DTO.InboxDTO inboxDTO = GenerateInboxMessage(truckInfo, reportType); try { _lottieAnimation.Visibility = ViewStates.Visible; _commentView.Visibility = ViewStates.Gone; var response = await inboxProxy.Create(inboxDTO); } catch (Exception ex) { _sendButton.Activated = true; Toast.MakeText(Activity, "¡Lo sentimos! El envío de comentarios no se encuentra disponible.", ToastLength.Long).Show(); } FragmentManager.BeginTransaction().Replace(Resource.Id.fragments_container, new Fragments.MessageSend()).Commit(); }
private InboxDTO GenerateInboxMessage(Tuple <int, string> truckInfo, ReportTypesEnum reportType) { DTO.InboxDTO inboxDTO = new DTO.InboxDTO(); inboxDTO.CreationDate = DateTime.Now; inboxDTO.Message = _messageText.Text; inboxDTO.ReportType = reportType; inboxDTO.TruckId = truckInfo.Item1.ToString(); inboxDTO.TruckName = truckInfo.Item2; inboxDTO.UserId = UserID; return(inboxDTO); }