Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {

#if SEGURIDAD_
            try
            {
                this.Hide();

                moduloLogin moduloSeguridad = new moduloLogin();
                moduloSeguridad.frm = this;
                moduloSeguridad.ShowDialog();

                sql.open();
                this.Text = "Comercializadora y Distribuidora \"El Sol\" S.A. de C.V. - " + sql.getNombreUsuario(ID);

                desabilitarTodosBotones();
                sql.CheckIn(ID);


                if (sql.getTipoUsuario(ID) == 1)
                {
                    botonModuloEmpleados.Enabled = true;
                    botonModuloCatalogo.Enabled = true;
                    botonModuloVentas.Enabled = true;
                    botonModuloCompras.Enabled = true;
                    botonModuloReportes.Enabled = true;
                    botonCerrarSesion.Enabled = true;
                }
                else
                {
                    botonModuloCatalogo.Enabled = true;
                    botonModuloVentas.Enabled = true;
                    botonCerrarSesion.Enabled = true;
                }

                sql.close();
                this.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("(" + ex.Source + "): " + ex.Message, "Error");
            } 
#else
            botonModuloEmpleados.Enabled = true;
            botonModuloCatalogo.Enabled = true;
            botonModuloVentas.Enabled = true;
            botonModuloCompras.Enabled = true;
            botonModuloReportes.Enabled = true;
            botonCerrarSesion.Visible = false;
            this.Text += " - Modo Admin";
#endif            
        }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
#if SEGURIDAD_
            try
            {
                this.Hide();

                moduloLogin moduloSeguridad = new moduloLogin();
                moduloSeguridad.frm = this;
                moduloSeguridad.ShowDialog();

                sql.open();
                this.Text = "Comercializadora y Distribuidora \"El Sol\" S.A. de C.V. - " + sql.getNombreUsuario(ID);

                desabilitarTodosBotones();
                sql.CheckIn(ID);


                if (sql.getTipoUsuario(ID) == 1)
                {
                    botonModuloEmpleados.Enabled = true;
                    botonModuloCatalogo.Enabled  = true;
                    botonModuloVentas.Enabled    = true;
                    botonModuloCompras.Enabled   = true;
                    botonModuloReportes.Enabled  = true;
                    botonCerrarSesion.Enabled    = true;
                }
                else
                {
                    botonModuloCatalogo.Enabled = true;
                    botonModuloVentas.Enabled   = true;
                    botonCerrarSesion.Enabled   = true;
                }

                sql.close();
                this.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("(" + ex.Source + "): " + ex.Message, "Error");
            }
#else
            botonModuloEmpleados.Enabled = true;
            botonModuloCatalogo.Enabled  = true;
            botonModuloVentas.Enabled    = true;
            botonModuloCompras.Enabled   = true;
            botonModuloReportes.Enabled  = true;
            botonCerrarSesion.Visible    = false;
            this.Text += " - Modo Admin";
#endif
        }
Ejemplo n.º 3
0
        private void cerrarSesion()
        {
            string verificarSalida = MessageBox.Show("Deseas salir del sistema?", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();

            if (verificarSalida == "Yes")
            {
                try
                {
                    sql.open();
                    sql.CheckOut(ID);
                    this.Hide();

                    moduloLogin moduloSeguridad = new moduloLogin();
                    moduloSeguridad.frm = this;
                    moduloSeguridad.ShowDialog();
                    this.Text = "Comercializadora y Distribuidora \"El Sol\" S.A. de C.V. - " + sql.getNombreUsuario(ID);

                    desabilitarTodosBotones();
                    sql.CheckIn(ID);

                    if (sql.getTipoUsuario(ID) == 1)
                    {
                        botonModuloEmpleados.Enabled = true;
                        botonModuloCatalogo.Enabled  = true;
                        botonModuloVentas.Enabled    = true;
                        botonModuloCompras.Enabled   = true;
                        botonModuloReportes.Enabled  = true;
                        botonCerrarSesion.Enabled    = true;
                    }
                    else
                    {
                        botonModuloCatalogo.Enabled = true;
                        botonModuloVentas.Enabled   = true;
                        botonCerrarSesion.Enabled   = true;
                    }

                    sql.close();
                    this.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("(" + ex.Source + "): " + ex.Message, "Error");
                }
            }
            else
            {
                // No hacer nada
            }
        }
Ejemplo n.º 4
0
        private void cerrarSesion()
        {
            string verificarSalida = MessageBox.Show("Deseas salir del sistema?", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
            if (verificarSalida == "Yes")
            {
                try
                {
                    sql.open();
                    sql.CheckOut(ID);
                    this.Hide();

                    moduloLogin moduloSeguridad = new moduloLogin();
                    moduloSeguridad.frm = this;
                    moduloSeguridad.ShowDialog();
                    this.Text = "Comercializadora y Distribuidora \"El Sol\" S.A. de C.V. - " + sql.getNombreUsuario(ID);

                    desabilitarTodosBotones();
                    sql.CheckIn(ID);

                    if (sql.getTipoUsuario(ID) == 1)
                    {
                        botonModuloEmpleados.Enabled = true;
                        botonModuloCatalogo.Enabled = true;
                        botonModuloVentas.Enabled = true;
                        botonModuloCompras.Enabled = true;
                        botonModuloReportes.Enabled = true;
                        botonCerrarSesion.Enabled = true;
                    }
                    else
                    {
                        botonModuloCatalogo.Enabled = true;
                        botonModuloVentas.Enabled = true;
                        botonCerrarSesion.Enabled = true;
                    }

                    sql.close();
                    this.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("(" + ex.Source + "): " + ex.Message, "Error");
                }

            }
            else
            {
                // No hacer nada
            }            
        }