public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup)inflater.Inflate (Resource.Layout.layout_ticketjuridico, null); TextView txtCorreo = root.FindViewById<TextView> (Resource.Id.txtEmail); TextView txtNombre = root.FindViewById<TextView> (Resource.Id.txtNombreApellido); TextView txtAvisoPrivacidad = root.FindViewById<TextView> (Resource.Id.txtAvisoPrivacidad); if (!string.IsNullOrEmpty (TipsFragment.Email)) { txtCorreo.Text = TipsFragment.Email.Trim (); } if (!string.IsNullOrEmpty (TipsFragment.Nombre)) { txtNombre.Text = TipsFragment.Nombre.Trim (); } //cocoservices.tinnova.mx.COCOService cliente = new Navigation_View.cocoservices.tinnova.mx.COCOService (); services_911consumidor_com.COCOService cliente = new Navigation_View.services_911consumidor_com.COCOService(); //cliente.ChannelFactory.CreateChannel (); string string_key = "41f579fc-1445-4065-ab10-c06d50e724d3"; Typeface font = Typeface.CreateFromAsset (Application.Context.Assets, "Fonts/HelveticaNeue-Thin.otf"); Button btnRegistrar = root.FindViewById<Button> (Resource.Id.btnAceptar); btnRegistrar.SetTypeface (font, TypefaceStyle.Normal); txtAvisoPrivacidad.Click += (object sender, EventArgs e) => { var uri = Android.Net.Uri.Parse ("http://www.911Consumidor.com/avisoPrivacidad"); var intent = new Intent (Intent.ActionView, uri); StartActivity (intent); }; btnRegistrar.Click += (object sender, EventArgs e) => { btnRegistrar.SetBackgroundColor (Color.White); btnRegistrar.SetTextColor (Color.Orange); string strError = ""; //EditText txtNombre = root.FindViewById<EditText> (Resource.Id.txtNombreApellido); EditText txtTelefono = root.FindViewById<EditText> (Resource.Id.txtPhone); Spinner ddEstado = root.FindViewById<Spinner> (Resource.Id.ddlEstado); EditText txtCiudad = root.FindViewById<EditText> (Resource.Id.txtCiudad); EditText txtNota = root.FindViewById<EditText> (Resource.Id.txtNota); Drawable icon_error = Resources.GetDrawable (Resource.Drawable.Error128); //cliente.ChannelFactory = try { Ticket ticket = new Ticket (); // if (!string.IsNullOrEmpty (txtNombre.Text.Trim ())) // ticket.Nombre = txtNombre.Text.Trim (); // else { // txtNombre.SetError ("Es requerido un Nombre ", icon_error); // strError += "Nombre"; // } ticket.Email = txtCorreo.Text.Trim (); if (!string.IsNullOrEmpty (txtTelefono.Text.Trim ())) ticket.Telefono = txtTelefono.Text.Trim (); else { txtTelefono.SetError ("Es requerido un Telefono ", icon_error); strError += "Telefono"; } if (!string.IsNullOrEmpty (txtNota.Text.Trim ())) ticket.Nota = txtNota.Text.Trim (); else { txtNota.SetError ("Es requerido un Comentario ", icon_error); strError += "Comentario"; } ticket.Ciudad = txtCiudad.Text.Trim (); ticket.Estado = ddEstado.SelectedItem.ToString (); var resultado = 0; if (string.IsNullOrEmpty (strError)) { resultado = cliente.CreateTicket ( new Navigation_View.services_911consumidor_com.TicketDTO { Client = new Navigation_View.services_911consumidor_com.UserDTO { FirstName = ticket.Nombre, LastName = string.Empty, Email = ticket.Email, Phone = ticket.Telefono, PostalCode = string.Empty, AddressCity = ticket.Ciudad, AddressState = ticket.Estado }, Status = new Navigation_View.services_911consumidor_com.StatusDTO { OBJ_ID = 2, Id = 3 }, Type = new Navigation_View.services_911consumidor_com.TypeDTO { ObjId = 2, Id = 3 }, User = new Navigation_View.services_911consumidor_com.UserDTO { Id = 3 }, TicketDetail = new Navigation_View.services_911consumidor_com.TicketDetailDTO[] { new Navigation_View.services_911consumidor_com.TicketDetailDTO { DetailDate = DateTime.Now, Subject = "Contacto Consumidor", Status = new Navigation_View.services_911consumidor_com.StatusDTO { OBJ_ID = 2, Id = 3 }, Message = string.Empty, Agent = new Navigation_View.services_911consumidor_com.UserDTO { UserId = string.Empty }, TIC_ID = 3 } }, Notes = ticket.Nota }, string_key); if (resultado != 0) { new AlertDialog.Builder (root.Context) .SetMessage ("Muchas gracias por ponerte en contacto con 911 CONSUMIDOR, en breve recibirás una respuesta a tu caso.") .SetPositiveButton ("OK", delegate { Console.WriteLine ("OK"); }) .SetTitle ("ATENCIÓN") .Show (); } } } catch (Exception ex) { new AlertDialog.Builder (root.Context) .SetMessage ("Ocurrio un error: " + ex.Message.ToString ()) .SetTitle ("ATENCIÓN") .SetPositiveButton ("OK", delegate { Console.WriteLine ("OK"); }) .Show (); } finally { //txtApellido.Text=""; txtNombre.Text = ""; txtNota.Text = ""; txtCiudad.Text = ""; txtCorreo.Text = ""; txtTelefono.Text = ""; ddEstado.GetItemIdAtPosition (0); } }; return root; }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); ViewGroup root = (ViewGroup)inflater.Inflate (Resource.Layout.layout_tickets,null); //cocoservices.tinnova.mx.COCOService cliente = new Navigation_View.cocoservices.tinnova.mx.COCOService (); services_911consumidor_com.COCOService cliente = new Navigation_View.services_911consumidor_com.COCOService(); string string_key = "41f579fc-1445-4065-ab10-c06d50e724d3"; Typeface font = Typeface.CreateFromAsset (Application.Context.Assets, "Fonts/HelveticaNeue-Thin.otf"); Button btnRegistrar = root.FindViewById<Button> (Resource.Id.btnAceptar); btnRegistrar.SetTypeface (font, TypefaceStyle.Normal); btnRegistrar.Click += (object sender, EventArgs e) => { btnRegistrar.SetBackgroundColor (Color.White); btnRegistrar.SetTextColor (Color.Orange); string strError = ""; EditText txtNombre = root.FindViewById<EditText> (Resource.Id.txtNombre); //EditText txtApellido = root.FindViewById<EditText>(Resource.Id.txtApellido); EditText txtCorreo = root.FindViewById<EditText> (Resource.Id.txtEmail); EditText txtTelefono = root.FindViewById<EditText> (Resource.Id.txtPhone); Spinner ddEstado = root.FindViewById<Spinner> (Resource.Id.ddlEstado); EditText txtCiudad = root.FindViewById<EditText> (Resource.Id.txtCiudad); //EditText txtCP = root.FindViewById<EditText>(Resource.Id.txtCP); EditText txtNota = root.FindViewById<EditText> (Resource.Id.txtNota); Drawable icon_error = Resources.GetDrawable (Resource.Drawable.Error128); //cliente.ChannelFactory = try { Ticket ticket = new Ticket (); if (!string.IsNullOrEmpty (txtNombre.Text.Trim ())) ticket.Nombre = txtNombre.Text.Trim (); else { //throw new Exception("Debe escribir un Nombre"); txtNombre.SetError ("Es requerido un Nombre ", icon_error); strError += "Nombre"; } if (!string.IsNullOrEmpty (txtCorreo.Text.Trim ())) ticket.Email = txtCorreo.Text.Trim (); else { txtCorreo.SetError ("Es requerido un Correo Electronico ", icon_error); strError += "Correo Electronico"; } if (!string.IsNullOrEmpty (txtTelefono.Text.Trim ())) ticket.Telefono = txtTelefono.Text.Trim (); else { txtTelefono.SetError ("Es requerido un Telefono ", icon_error); strError += "Telefono"; } if (!string.IsNullOrEmpty (txtNota.Text.Trim ())) ticket.Nota = txtNota.Text.Trim (); else { txtNota.SetError ("Es requerido un Comentario ", icon_error); strError += "Comentario"; } ticket.Ciudad = txtCiudad.Text.Trim (); ticket.Estado = ddEstado.SelectedItem.ToString (); if (string.IsNullOrEmpty (strError)) { var resultado = cliente.CreateTicket ( new Navigation_View.services_911consumidor_com.TicketDTO { Client = new Navigation_View.services_911consumidor_com.UserDTO { FirstName = ticket.Nombre, LastName = string.Empty, Email = ticket.Email, Phone = ticket.Telefono, PostalCode = string.Empty, AddressCity = ticket.Ciudad, AddressState = ticket.Estado, }, Status = new Navigation_View.services_911consumidor_com.StatusDTO { OBJ_ID = 2, Id = 3 }, Type = new Navigation_View.services_911consumidor_com.TypeDTO { ObjId = 2, Id = 1 }, User = new Navigation_View.services_911consumidor_com.UserDTO { Id = 1 }, TicketDetail = new Navigation_View.services_911consumidor_com.TicketDetailDTO[] { new Navigation_View.services_911consumidor_com.TicketDetailDTO { DetailDate = DateTime.Now, Subject = "Contacto Consumidor", Status = new Navigation_View.services_911consumidor_com.StatusDTO { OBJ_ID = 2, Id = 3 }, Message = string.Empty, Agent = new Navigation_View.services_911consumidor_com.UserDTO { UserId = string.Empty } } }, Notes = ticket.Nota }, string_key); if (resultado != 0) { new AlertDialog.Builder (root.Context) .SetMessage ("Muchas gracias por ponerte en contacto con 911 CONSUMIDOR, en breve recibirás una respuesta a tu caso.") .SetTitle ("ATENCIÓN") .Show (); } } } catch (Exception ex) { new AlertDialog.Builder (root.Context) .SetMessage ("Ocurrio un error: " + ex.Message.ToString ()) .SetTitle ("ATENCIÓN") .Show (); } finally { //txtApellido.Text=""; txtNombre.Text = ""; txtNota.Text = ""; txtCiudad.Text = ""; txtCorreo.Text = ""; txtTelefono.Text = ""; //ddEstado.SelectedItemPosition = -1; } }; return root; }