Ejemplo n.º 1
0
 partial void btnCanjear_TouchUpInside(UIButton sender)
 {
     if (this.txtCupon.Text != "")
     {
         if (InternetConectionHelper.VerificarConexion())
         {
             datosDescuento = Cupon.AplicarCupon(this.txtCupon.Text);
             if (datosDescuento.Descuento_Id != null)
             {
                 this.datosDescuentoDelegate.DescuentoAplicado(datosDescuento);
                 this.DismissViewController(true, null);
             }
             else
             {
                 new MessageDialog().SendToast("El código de cupón no es válido");
             }
         }
         else
         {
             new MessageDialog().SendToast("No tienes conexión a internet, intenta mas tarde");
         }
     }
     else
     {
         new MessageDialog().SendToast("Ingresa un código de cupón");
     }
 }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            StyleHelper.StyleBlack(this.vwInfoGeneral.Layer);
            StyleHelper.StyleBlack(this.imgPerfil.Layer);
            if (InternetConectionHelper.VerificarConexion())
            {
                var Miembro = new MiembrosController().GetMemberData((ListUser[0] != "") ? ListUser[0] : ListUser[1], ListUser[2]);
                this.lblCorreo.Text      = (Miembro.Miembro_Correo_Electronico != "") ? Miembro.Miembro_Correo_Electronico : "Sin Info";
                this.lblNombre.Text      = (Miembro.Miembro_Nombre != "") ? Miembro.Miembro_Nombre : "Sin Info";
                this.lblPuesto.Text      = (Miembro.Miembro_Puesto != "") ? Miembro.Miembro_Puesto : "Sin Info";
                this.lblEmpresa.Text     = (Miembro.Miembro_Empresa != null) ? Miembro.Miembro_Empresa : "Sin Info";
                this.lblProfesion.Text   = (Miembro.Miembro_Profesion != "") ? Miembro.Miembro_Profesion : "Sin Info";
                this.lblTelContacto.Text = (Miembro.Miembro_Telefono != "") ? Miembro.Miembro_Telefono : "Sin Info";
                if (Miembro.Miembro_Fecha_Nacimiento != "")
                {
                    var arrFecha = Miembro.Miembro_Fecha_Nacimiento.Split('-');
                    this.lblFechaNacimiento.Text      = arrFecha[2] + "/" + arrFecha[1] + "/" + arrFecha[2];
                    this.lblFechaNacimiento.TextColor = UIColor.Clear.FromHex(0x95D6FF);
                }
                else
                {
                    this.lblFechaNacimiento.Text      = "Sin Info";
                    this.lblFechaNacimiento.TextColor = UIColor.Clear.FromHex(0x444444);
                }

                this.lblCorreo.TextColor      = (this.lblCorreo.Text == "Sin Info") ? UIColor.Clear.FromHex(0x444444) : UIColor.Clear.FromHex(0x95D6FF);
                this.lblPuesto.TextColor      = (this.lblPuesto.Text == "Sin Info") ? UIColor.Clear.FromHex(0x444444) : UIColor.Clear.FromHex(0x95D6FF);
                this.lblProfesion.TextColor   = (this.lblProfesion.Text == "Sin Info") ? UIColor.Clear.FromHex(0x444444) : UIColor.Clear.FromHex(0x95D6FF);
                this.lblTelContacto.TextColor = (this.lblTelContacto.Text == "Sin Info") ? UIColor.Clear.FromHex(0x444444) : UIColor.Clear.FromHex(0x95D6FF);
            }
            else
            {
                new MessageDialog().SendToast("No tienes acceso a una conexión de Internet");
            }
        }
Ejemplo n.º 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            if (InternetConectionHelper.VerificarConexion())
            {
                this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIImage.FromBundle("ic_qr"), UIBarButtonItemStyle.Plain, (sender, e) =>
                {
                    UIActivityIndicatorView waiting = new UIActivityIndicatorView
                    {
                        Frame = new CGRect(UIScreen.MainScreen.Bounds.Width / 2, UIScreen.MainScreen.Bounds.Height / 2, 30, 30)
                    };
                    View.AddSubview(waiting);
                    UIViewController controller = this.Storyboard.InstantiateViewController("AccesoController");
                    controller.Title            = "Control de Acceso";
                    this.NavigationController.PushViewController(controller, true);
                }), true);
                posts = new Controllers.EscritorioController().GetMuroPosts(currentPage);
            }
            else
            {
                isShowInformation = false;
                existeConeccion   = false;
            }

            SVProgressHUD.Dismiss();
        }
Ejemplo n.º 4
0
        private void PublicarPost()
        {
            BTProgressHUD.Show();

            byte[] Fotografia;
            if (ImagenPublicacion != null)
            {
                Fotografia = ImagenPublicacion?.AsPNG().ToArray();
            }
            else
            {
                Fotografia = new byte[0];
            }

            if (InternetConectionHelper.VerificarConexion())
            {
                if (new Controllers.EscritorioController().SetPost(KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"), txtPublicacion.Text, Fotografia))
                {
                    this.PostPublicadoDelegate.PostPublicado();
                    this.SendMessage();
                    this.DismissViewController(true, null);
                    BTProgressHUD.Dismiss();
                }
                else
                {
                    BTProgressHUD.Dismiss();
                    new MessageDialog().SendToast("No pudimos publicar tu mensaje, intenta de nuevo");
                }
            }
            else
            {
                BTProgressHUD.Dismiss();
                new MessageDialog().SendToast("No tienes conexión a internet, intenta de nuevo");
            }
        }
Ejemplo n.º 5
0
using System;
using UIKit;
//using PerpetualEngine.Storage;
using WorklabsMx.Controllers;
using System.Collections.Generic;
using Foundation;
using System.Text.RegularExpressions;
using WorklabsMx.iOS.Helpers;
using BigTed;
using System.Threading.Tasks;
using Plugin.FirebasePushNotification;

namespace WorklabsMx.iOS
{
    public partial class LoginViewController : UIViewController
    {
        String EmailRegex = "";
        String PassWordRegex = "";

        String LongitudEmail = "";
        String LongitudPassword = "";

        //Constructor
        public LoginViewController(IntPtr handle) : base(handle)
        {
         
        }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.TestPush();
            UIView statusBar = UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) as UIView;
            if (statusBar.RespondsToSelector(new ObjCRuntime.Selector("setBackgroundColor:")))
            {
                statusBar.BackgroundColor = UIColor.Black;
            }
            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
            this.txtEmail.AttributedPlaceholder = new NSAttributedString("Ingresa tu correo electrónico", null, UIColor.Clear.FromHex(0xFEEC64));
            this.txtPassword.AttributedPlaceholder = new NSAttributedString("Ingresa tu contraseña", null, UIColor.Clear.FromHex(0xFEEC64));

            NavigationItem.Title = "Iniciar Sesión";
            //var localStorage = SimpleStorage.EditGroup("Login");

            EmailRegex = KeyChainHelper.GetKey("EmailRegex");
            PassWordRegex = KeyChainHelper.GetKey("PasswordRegex");
            LongitudEmail = KeyChainHelper.GetKey("LongitudEmail");
            LongitudPassword = KeyChainHelper.GetKey("LongitudPassword");

            KeyChainHelper.DeleteKey("Usuario_Id");
            KeyChainHelper.DeleteKey("Usuario_Tipo");

            StyleHelper.Style(txtEmail.Layer);
            StyleHelper.Style(txtPassword.Layer);
            StyleHelper.Style(btnIniciarSesion.Layer);
            StyleHelper.Style(btnRegistro.Layer);
    
        }

        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            this.EventosTecladoTextfileds();
            this.LimiteCaracteresTextFields(this.txtEmail, int.Parse(LongitudEmail));
            this.LimiteCaracteresTextFields(this.txtPassword, int.Parse(LongitudPassword));
            this.btnRecuperar.Enabled = false;
            this.btnRecuperar.Hidden = true;
        }


        private void TestPush()
        {
            CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) =>
            {
                System.Diagnostics.Debug.WriteLine($"TOKEN : {p.Token}");
            };

            CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
            {

                System.Diagnostics.Debug.WriteLine("Received");

            };

            CrossFirebasePushNotification.Current.OnNotificationOpened += (s, p) =>
            {
                System.Diagnostics.Debug.WriteLine("Opened");
                foreach (var data in p.Data)
                {
                    System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}");
                }

                if (!string.IsNullOrEmpty(p.Identifier))
                {
                    System.Diagnostics.Debug.WriteLine($"ActionId: {p.Identifier}");
                }

            };
        }

        void NavigateToTabbed()
        {
            InvokeOnMainThread(() =>
                {
                    var app = (AppDelegate)UIApplication.SharedApplication.Delegate;
                    app.Window.RootViewController = UIStoryboard.FromName("Main", null)
                    .InstantiateViewController("NavEscritorio")
                    as UIViewController;
                });
        }

        /* Acciona eventos para los textfields de ocultar teclado en patalla cuando se presiona la tecla intro, y en le caso de el textfield de contraseña
         se procede a iniciar sesion cuando se presiona la tecla intro */
        private void EventosTecladoTextfileds() 
        {
           this.txtEmail.ShouldReturn += (textField) => {
             this.txtPassword.BecomeFirstResponder();
               return true;
           } ;

           this.txtPassword.ShouldReturn += (textField) => {
              this.AccionIniciarSesion();
                textField.ResignFirstResponder();
              return true;
           } ;
        }


        //Evento que se ejecuta cuando se toca la pantalla, despues procede a ocultar el teclado
       public override void TouchesBegan(NSSet touches, UIEvent evt)
       {
          base.TouchesBegan(touches, evt);
           UITouch touch = touches.AnyObject as UITouch;
          if (touch != null)
         {
              View.EndEditing(true);
         }
      }

        /* Metodo que realiza el inicio de sesion, se ejecuta cuando el usuario presiona el boton de iniciar sesion o cuando el usuario la tecla intro mientras esta posicionado
         en el cuadro de texto de la contraseñ */
        private async void AccionIniciarSesion()
        {
            View.EndEditing(true);
            BTProgressHUD.Show(status: "Iniciando sesión");
            await Task.Delay(2000);
            if (InternetConectionHelper.VerificarConexion())
            {
                List<string> MiembrosId =  new LoginController().MemberLogin(this.txtEmail.Text, this.txtPassword.Text);

                bool EmailEsValido = this.ElTextoEsValido(this.txtEmail, EmailRegex);
                bool PasswordEsValido = this.ElTextoEsValido(this.txtPassword, PassWordRegex);

                if (/*PasswordEsValido &&*/ EmailEsValido)
                {
                    if (MiembrosId.Count > 0)
                    {
                        KeyChainHelper.SetKey("Usuario_Id", MiembrosId[0]);
                        KeyChainHelper.SetKey("Usuario_Tipo", MiembrosId[1]);
                        MenuHelper.GetUsuarioInfo();
                        BTProgressHUD.Dismiss();
                        NavigateToTabbed();
                    }
                    else
                    {
                        BTProgressHUD.Dismiss();
                        new MessageDialog().SendToast("Asegurese de que el Correo y/o contraseña sean los correctos");
                    }
                }
                else
                {
                    BTProgressHUD.Dismiss();
                    new MessageDialog().SendToast("Asegurese de que el Correo y/o contraseña tengan el formato correcto");
                }

            }
            else
            {
                BTProgressHUD.Dismiss();
                new MessageDialog().SendToast("No tienes acceso a una conexión de Internet");
            }
      }

        //Define el limite de caracteres a escribir en cada cuadro de texto de esta pantalla
        private void LimiteCaracteresTextFields(UITextField TextField, int LongitudMaxima) 
        {
          TextField.ShouldChangeCharacters = (textField, range, replacementString) =>
            {
              var newLength = textField.Text.Length + replacementString.Length - range.Length;
               return newLength <= LongitudMaxima;
            } ;
        }

        private Boolean ElTextoEsValido(UITextField TextField, String RegularExpr) 
        {
            bool EsValido = Regex.IsMatch(TextField.Text, RegularExpr);
            return EsValido;
        }

        // Cuando se toca el boton iniciar sesion se desancadena este evento
        partial void BtnIniciarSesion_TouchUpInside(UIButton sender)
        {
            this.AccionIniciarSesion();
        }

        partial  void BtnRestaurar_TouchUpInside(UIButton sender)
        {

            string miembro = new LoginController().ValidateMember(txtEmailRecuperar.Text);
            if (miembro.Length > 0)
            {
                //var result = new Emails().SendMail(txtEmailRecuperar.Text, miembro, new PassSecurity().GeneraIdentifier());

            }
        }

        partial void BtnRegistro_TouchUpInside(UIButton sender) =>
            UIApplication.SharedApplication.OpenUrl(new NSUrl("http://worklabs.mx"));


    }
}


Ejemplo n.º 6
0
 private void GetReservaciones(int TipoResrvacion)
 {
     if (InternetConectionHelper.VerificarConexion())
     {
         this.Reservaciones = new SalasJuntasController().GetReservaciones(KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"), TipoResrvacion);
         //this.Reservaciones.Sort((p, q) => int.Parse(p.Sala_Hora_Inicio.Replace(":00:00.0000000","")).CompareTo(int.Parse(q.Sala_Hora_Inicio.Replace(":00:00.0000000", ""))));
     }
 }
Ejemplo n.º 7
0
 private void AsignarFavorito()
 {
     if (InternetConectionHelper.VerificarConexion())
     {
         var result = new UsuariosController().AddMiembroFavorito(KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"), this.Usuario_Id, this.Usuario_Tipo);
         if (result)
         {
             btnSeguir.Hidden  = true;
             btnSeguir.Enabled = false;
         }
     }
 }
Ejemplo n.º 8
0
        async Task RefreshAccess()
        {
            await Task.Delay(50);

            if (InternetConectionHelper.VerificarConexion())
            {
                string newAcceso = new UsuariosController().GetLlaveAcceso(KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"));
                strAcceso   = newAcceso;
                imgQr.Image = ImageGallery.LoadImageUrl(newAcceso);
            }
            BTProgressHUD.Dismiss();
        }
Ejemplo n.º 9
0
 public override void ViewWillAppear(bool animated)
 {
     base.ViewWillAppear(animated);
     if (InternetConectionHelper.VerificarConexion())
     {
         //Cargar allProducts
     }
     else
     {
         isShowInformation = false;
         existeConeccion   = false;
     }
 }
Ejemplo n.º 10
0
        private async void VerificarConn()
        {
            var result = false;

            BTProgressHUD.Show(status: "Intentando Conectar");
            await Task.Delay(1000);

            if (InternetConectionHelper.VerificarConexion())
            {
                MenuHelper.GetListConfiguraciones();
                if (MenuHelper.Configuraciones == null)
                {
                    this.lblMensaje.Text  = "Estamos realizando manteniemiento a nuestro sistema";
                    this.lblMensaje2.Text = "Por favor intenta mas tarde";
                }
                else
                {
                    var configuracionCorreo   = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "REGEX Y LONGITUD DE CORREO ELECTRONICO DEL USUARIO");
                    var configuracionPassword = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "REGEX Y LONGITUD DE CONTRASEÑA DEL USUARIO");
                    if ((configuracionCorreo == null || configuracionPassword == null))
                    {
                        BTProgressHUD.Dismiss();
                        new MessageDialog().SendToast("No pudimos conectarte a nuestros servidores");
                    }
                    else
                    {
                        MenuHelper.GetUsuarioInfo();
                        MenuHelper.UploadImagePath  = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "RUTA DE IMAGENES DE PUBLICACIONES").Parametro_Varchar_1;
                        MenuHelper.ProfileImagePath = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "RUTA DE IMAGENES DE PERFILES DE USUARIOS").Parametro_Varchar_1;
                        result = KeyChainHelper.SetKey("EmailRegex", configuracionCorreo.Parametro_Varchar_1);
                        result = KeyChainHelper.SetKey("LongitudEmail", configuracionCorreo.Parametro_Varchar_2);
                        result = KeyChainHelper.SetKey("PasswordRegex", configuracionPassword.Parametro_Varchar_1);
                        result = KeyChainHelper.SetKey("LongitudPassword", configuracionPassword.Parametro_Varchar_2);

                        var app = (AppDelegate)UIApplication.SharedApplication.Delegate;
                        if (!string.IsNullOrEmpty(KeyChainHelper.GetKey("Usuario_Id")) && !string.IsNullOrEmpty(KeyChainHelper.GetKey("Usuario_Tipo")))
                        {
                            app.Window.RootViewController = UIStoryboard.FromName("Main", null).InstantiateViewController("NavEscritorio") as UIViewController;
                        }
                        else
                        {
                            app.Window.RootViewController = UIStoryboard.FromName("Main", null).InstantiateViewController("LoginViewController") as UIViewController;
                        }
                    }
                }
            }
            BTProgressHUD.Dismiss();
            new MessageDialog().SendToast("Aun no tienes conexión a internet");
        }
Ejemplo n.º 11
0
 private void PublicarPost(string MensajePublicacion, byte[] fotografia, int TipoPost)
 {
     if (InternetConectionHelper.VerificarConexion())
     {
         if (new Controllers.EscritorioController().SetPost(KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"), MensajePublicacion, fotografia))
         {
         }
         else
         {
         }
     }
     else
     {
     }
 }
Ejemplo n.º 12
0
 async Task FillData(string nombre = "", string apellido = "", string puesto = "", string profesion = "", string habilidades = "", bool disponibilidad = true, string pais = "", string estado = "", string municipio = "")
 {
     await Task.Run(() =>
     {
         if (InternetConectionHelper.VerificarConexion())
         {
             this.UsuariosFavoritos = new UsuariosController().GetMiembrosFavoritos(KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"));
         }
         else
         {
             BTProgressHUD.Dismiss();
             this.existeConeccion   = false;
             this.isShowInformation = false;
         }
     });
 }
Ejemplo n.º 13
0
 public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, Foundation.NSIndexPath indexPath)
 {
     if (editingStyle == UITableViewCellEditingStyle.Delete)
     {
         bool eliminado = false;
         if (InternetConectionHelper.VerificarConexion())
         {
             eliminado = new SalasJuntasController().CancelarSalaJuntas("BAJA", this.Reservaciones[indexPath.Row].Sala_Junta_Reservacion_Id);
         }
         if (eliminado)
         {
             tableView.BeginUpdates();
             Reservaciones.RemoveAt(indexPath.Row);
             tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Automatic);
             tableView.EndUpdates();
         }
     }
 }
Ejemplo n.º 14
0
        partial void btnConfirmar_Touch(UIButton sender)
        {
            var OperacionTerminada = false;

            if (InternetConectionHelper.VerificarConexion())
            {
                DateTime myDate = DateTime.ParseExact(Reservacion.Sala_Fecha, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
                if (Reservacion.Sala_Hora_Inicio == "24:00")
                {
                    Reservacion.Sala_Hora_Inicio = "00:00";
                }

                if (Reservacion.Sala_Hora_Fin == "24:00")
                {
                    Reservacion.Sala_Hora_Fin = "00:00";
                }
                var asignacion = new SalasJuntasController().AsignarSalaJuntas("ALTA", Reservacion.Sala_Id, KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"), myDate, Reservacion.Sala_Hora_Inicio, Reservacion.Sala_Hora_Fin, Reservacion.Creditos_Usados.ToString());
                if (asignacion != -1)
                {
                    OperacionTerminada = true;
                }
                else
                {
                    OperacionTerminada = false;
                }
            }

            if (OperacionTerminada)
            {
                this.DismissViewController(true, () =>
                {
                    this.GenerarEvento(Reservacion);


                    NSDateFormatter dateFormat = new NSDateFormatter();
                    dateFormat.DateFormat      = "yyyy-MM-dd";
                    NSDate newFormatDate       = dateFormat.Parse(FechaReservacion);

                    this.EnviarMail(MenuHelper.Usuario, SalaActual, newFormatDate, Reservacion);

                    this.EventosReservacionesDelegate.ReservacionConfirmada(this.Reservacion);
                });
            }
        }
Ejemplo n.º 15
0
        partial void btnInvitar_Touch(UIButton sender)
        {
            var ErrorInvitar = false;

            foreach (UsuarioModel invitado in invitadosLocal)
            {
                var Sucursal = sucursales.Find(x => x.Sucursal_Descripcion == lblUbicacion.Text);
                if (InternetConectionHelper.VerificarConexion())
                {
                    if (new InvitadosController().RegistraInvitado(invitado.Usuario_Nombre, invitado.Usuario_Apellidos, invitado.Usuario_Correo_Electronico, txtAsunto.Text, DateTime.Parse(lblFecha.Text), Sucursal.Sucursal_Id, KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo")) != -1)
                    {
                        ErrorInvitar             = false;
                        this.DomicilioInvitacion = Sucursal.Sucursal_Descripcion + " " + Sucursal.Sucursal_Domicilio;
                        BTProgressHUD.Show(status: "Enviando Correo de Invitación");
                        this.EnviarMail(invitado, Sucursal);
                    }
                    else
                    {
                        ErrorInvitar = true;
                        break;
                    }
                }
                else
                {
                    ErrorInvitar = true;
                    break;
                }
            }
            BTProgressHUD.Dismiss();
            if (ErrorInvitar)
            {
                new MessageDialog().SendToast("No se pudieron enviar las invitaciones, intente de nuevo");
            }
            else
            {
                EventosDetalleInvitacionDel.Asunto(txtAsunto.Text);
                EventosDetalleInvitacionDel.ConfirmarInvitaciones(invitadosLocal);
            }
        }
Ejemplo n.º 16
0
        private void AgendarSala()
        {
            var OperacionTerminada = false;

            if (InternetConectionHelper.VerificarConexion())
            {
                DateTime myDate = DateTime.ParseExact(Reservacion.Sala_Fecha, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
                if (Reservacion.Sala_Hora_Inicio == "24:00")
                {
                    Reservacion.Sala_Hora_Inicio = "00:00";
                }

                if (Reservacion.Sala_Hora_Fin == "24:00")
                {
                    Reservacion.Sala_Hora_Fin = "00:00";
                }
                var asignacion = new SalasJuntasController().AsignarSalaJuntas("ALTA", Reservacion.Sala_Id, KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"), myDate, Reservacion.Sala_Hora_Inicio, Reservacion.Sala_Hora_Fin, Reservacion.Creditos_Usados.ToString());
                if (asignacion != -1)
                {
                    OperacionTerminada = true;
                }
                else
                {
                    OperacionTerminada = false;
                }
            }

            if (OperacionTerminada)
            {
                this.GenerarEvento(Reservacion);
                NSDateFormatter dateFormat = new NSDateFormatter();
                dateFormat.DateFormat = "yyyy-MM-dd";
                NSDate newFormatDate = dateFormat.Parse(this.FechaSeleccionada);
                this.EnviarMail(MenuHelper.Usuario, SalaJuntasSeleccionada, newFormatDate, Reservacion);
                this.PerformSegue("Confirmacion", null);
            }
        }
Ejemplo n.º 17
0
 // class-level declarations
        public override UIWindow Window
        {
            get;
            set;
        }

        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            App.Initialize();
            var user = NSUserDefaults.StandardUserDefaults;
            if (user.BoolForKey("hasRunBefore") == false)
            {
                KeyChainHelper.DeleteKey("Usuario_Id");
                KeyChainHelper.DeleteKey("Usuario_Tipo");
                KeyChainHelper.DeleteKey("Empresa_Id");
                user.SetBool(true, "hasRunBefore");
                user.Synchronize();
            }

            UIApplication.SharedApplication.StatusBarHidden = false;
            application.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            UINavigationBar.Appearance.BarTintColor = UIColor.Black;
            UINavigationBar.Appearance.TintColor = UIColor.White;
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes() { TextColor = UIColor.White });
            UINavigationBar.Appearance.Translucent = false;

            var result = false;

            if (InternetConectionHelper.VerificarConexion())
     {
                MenuHelper.GetListConfiguraciones();
                if (MenuHelper.Configuraciones != null)
                {
                    var configuracionCorreo = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "REGEX Y LONGITUD DE CORREO ELECTRONICO DEL USUARIO"); //new ConfigurationsController().GetConfiguraciones("REGEX Y LONGITUD DE CORREO ELECTRONICO DEL USUARIO");
                    var configuracionPassword = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "REGEX Y LONGITUD DE CONTRASEÑA DEL USUARIO");//new ConfigurationsController().GetConfiguraciones("REGEX Y LONGITUD DE CONTRASEÑA DEL USUARIO");
                    if ((configuracionCorreo == null || configuracionPassword == null))
                    {
                        Window.RootViewController = UIStoryboard.FromName("Main", null).InstantiateViewController("NoConexion");
                    }
                    else
                    {
                        MenuHelper.UploadImagePath = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "RUTA DE IMAGENES DE PUBLICACIONES").Parametro_Varchar_1;
                        MenuHelper.ProfileImagePath = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "RUTA DE IMAGENES DE PERFILES DE USUARIOS").Parametro_Varchar_1;
                        result = KeyChainHelper.SetKey("EmailRegex", configuracionCorreo.Parametro_Varchar_1);
                        result = KeyChainHelper.SetKey("LongitudEmail", configuracionCorreo.Parametro_Varchar_2);
                        result = KeyChainHelper.SetKey("PasswordRegex", configuracionPassword.Parametro_Varchar_1);
                        result = KeyChainHelper.SetKey("LongitudPassword", configuracionPassword.Parametro_Varchar_2);
                    }
                    if (!string.IsNullOrEmpty(KeyChainHelper.GetKey("Usuario_Id")) && !string.IsNullOrEmpty(KeyChainHelper.GetKey("Usuario_Tipo")))
                    {
                        MenuHelper.GetUsuarioInfo();
                        Window.RootViewController = UIStoryboard.FromName("Main", null)
                            .InstantiateViewController("NavEscritorio");
                    }
                    else
                    {
                        var controller = UIStoryboard.FromName("Main", null).InstantiateViewController("LoginViewController");
                        controller.Title = "Iniciar Sesión";
                        Window.RootViewController = controller;
                    }
                }
                else
                {
                    Window.RootViewController = UIStoryboard.FromName("Main", null).InstantiateViewController("NoConexion");
                }
     }
     else
     {
                Window.RootViewController = UIStoryboard.FromName("Main", null).InstantiateViewController("NoConexion");
            }
            UIApplication.SharedApplication.RegisterForRemoteNotifications();
            var settings = UIUserNotificationSettings.GetSettingsForTypes(
                UIUserNotificationType.Alert, new NSSet());
            UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            FirebasePushNotificationManager.Initialize(launchOptions, true);
            UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert, (approved, err) => {
                // Handle approval
            });
            // Get current notification settings
            UNUserNotificationCenter.Current.GetNotificationSettings ((set) => {
                var alertsAllowed = (set.AlertSetting == UNNotificationSetting.Enabled);
            }); 
                // Enable or disable features based on authorization.
            UNUserNotificationCenter.Current.Delegate = new UNUserNotificationCenterDelegate();

            return true;
        }

        public override void OnResignActivation(UIApplication application)
        {
            // Invoked when the application is about to move from active to inactive state.
            // This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) 
            // or when the user quits the application and it begins the transition to the background state.
            // Games should use this method to pause the game.
        }


        public override void WillEnterForeground(UIApplication application)
        {
            // Called as part of the transiton from background to active state.
            // Here you can undo many of the changes made on entering the background.
        }


        public override void WillTerminate(UIApplication application)
        {
            // Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
        }

        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            FirebasePushNotificationManager.DidRegisterRemoteNotifications(deviceToken);
        }


        public override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
        {
            FirebasePushNotificationManager.RemoteNotificationRegistrationFailed(error);


        }
        // To receive notifications in foregroung on iOS 9 and below.
        // To receive notifications in background in any iOS version
        public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
        {