Exemple #1
0
 private void frmServidorRemoto_Load(object sender, EventArgs e)
 {
     Listar_Usuarios();
     if (DatUser.AUX_CONEXION.Equals("CORRECTO"))
     {
         Dispose();
         frmRegistroEmpresa frmRegistroEmpresa = new frmRegistroEmpresa();
         frmRegistroEmpresa.ShowDialog();
     }
 }
Exemple #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Stop();
            List <User> lstUsuarios     = new BusUser().ListarUsuarios();
            int         contadorUsuario = lstUsuarios.Count;
            string      INDICADOR       = DatUser.AUX_CONEXION;

            //   MessageBox.Show(INDICADOR);

            if (DatUser.AUX_CONEXION == "CORRECTO")
            {
                if (contadorUsuario == 0 || lstUsuarios == null)
                {
                    Hide();
                    frmRegistroEmpresa registroEmpresa = new frmRegistroEmpresa();
                    registroEmpresa.ShowDialog();
                    this.Dispose();
                }
            }

            if (DatUser.AUX_CONEXION == "INCORRECTO")
            {
                Hide();
                frmServidorRemoto servidorRemoto = new frmServidorRemoto();
                servidorRemoto.ShowDialog();
                this.Dispose();
            }

            try
            {
                ManagementObject mos = new ManagementObject(@"Win32_PhysicalMedia='\\.\PHYSICALDRIVE0'");
                //foreach (ManagementObject getSerial in mos.Get())
                //{
                serialPC = mos.Properties["SerialNumber"].Value.ToString().Trim();
                IdCaja   = new BusBox().showBoxBySerial(serialPC).Id;
                // }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            try
            {
                Licencia licencia = new BusLicencia().Obtener_LicenciaTemporal();

                dtpVencimiento.Value = Convert.ToDateTime(EncriptarTexto.Desencriptar(licencia.FechaVencimiento));
                string serial = EncriptarTexto.Desencriptar(licencia.Serial);
                string estado = EncriptarTexto.Desencriptar(licencia.Estado);
                dtpFechaActivacion.Value = Convert.ToDateTime(EncriptarTexto.Desencriptar(licencia.FechaActivacion));

                label3.Text = estado;
                label2.Text = serial;
                //dtpFechaActivacion.Value = Convert.ToDateTime( fechaActivacion );
                // dtpVencimiento.Value = Convert.ToDateTime( VencimientoLicencia );
                dtpFechaActivacion.Format = DateTimePickerFormat.Custom;
                dtpVencimiento.Format     = DateTimePickerFormat.Custom;

                if (estado != "VENCIDO")
                {
                    string   fechaActual = Convert.ToString(DateTime.Now);
                    DateTime hoy         = Convert.ToDateTime(fechaActual.Split(' ')[0]);

                    if (dtpVencimiento.Value >= hoy)
                    {
                        int mes       = dtpFechaActivacion.Value.Month;
                        int mesActual = hoy.Month;
                        if (mes <= mesActual)
                        {
                            if (estado.Equals("?ACTIVO?"))
                            {
                                lblLicencia.Text = "Licencia activada hasta el : " + dtpVencimiento.Value.ToString("dd/MM/yyyy");
                            }
                            else if (estado.Equals("?ACTIVADO PREMIUM?"))
                            {
                                lblLicencia.Text = "Licencia profesional Activada hasta el : " + dtpVencimiento.Value.ToString("dd/MM/yyyy");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }