Beispiel #1
0
        private void txtContraseña_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                e.SuppressKeyPress = true;
                NegocioUsuario objusuario = new NegocioUsuario();
                FrmInicio      objini     = new FrmInicio();
                try
                {
                    if (e.KeyCode == Keys.Enter)
                    {
                        if (objusuario.login(txtUsuario.Text, txtContraseña.Text) == true)
                        {
                            // NegocioConfigEmpresa.inivarglobal (System.Environment.MachineName,txtUsuario.Text,"mañana",);
                            // VERIFICA QUE EL EQUIPO ESTE DADO DE ALTA SI LO ESTA ACTUALIZA EL USUARIO SINO AGREGA EL EQUIPO
                            string msg = NegocioConfigEmpresa.mostrarequipo(System.Environment.MachineName);
                            NegocioConfigEmpresa.mostrar();
                            NegocioConfigEmpresa.nombreusuario = objusuario.Nombreusuario;
                            NegocioConfigEmpresa.usuariosa     = objusuario.Usuariosa;
                            NegocioConfigEmpresa.ReglasUsuario = objusuario.Reglaprivilegio.ToString().Split(',');


                            if (msg == "ok")
                            {
                                msg = NegocioConfigEmpresa.actualizarequipo(objusuario.Usuario, UtilityFrm.turnosegunhora(), objusuario.Idusuario, DateTime.Now, NegocioConfigEmpresa.idequipo);

                                msg = NegocioConfigEmpresa.mostrarequipo(System.Environment.MachineName);

                                if (msg == "ok")
                                {
                                    this.Hide();
                                    objini.Show();
                                }
                                else
                                {
                                    MessageBox.Show(msg);
                                }
                            }
                            else
                            {
                                MessageBox.Show(msg);
                                NegocioConfigEmpresa.confequipo(System.Environment.MachineName, txtUsuario.Text, UtilityFrm.turnosegunhora(), objusuario.Idusuario, 1, DateTime.Now, "", "", 1, 1, 1, "");
                            }
                        }
                        else
                        {
                            MessageBox.Show("El usuario o contraseña es incorrecta");
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                btnIngresar.Focus();
            }
        }
Beispiel #2
0
        private void mostrarDatos()
        {
            try
            {
                DataTable dt = NegocioConfigEmpresa.mostrar();
                if (dt.Rows.Count == 1)
                {
                    //si hay datos el boolean datos se pone a true
                    datos = true;
                    foreach (DataRow item in dt.Rows)
                    {
                        txtRazonSocial.Text        = item["razon_social"].ToString();
                        txtCuit.Text               = item["cuit"].ToString();
                        cbxCondicionFrenteIVA.Text = item["condicion_frente_iva"].ToString();
                        string imagen1 = item["logo"].ToString();


                        if (item["path_backup"].ToString() != null || item["path_backup"].ToString() != "")
                        {
                            txtRuta.Text = item["path_backup"].ToString();
                            sincronizarBackup(txtRuta.Text);
                        }
                        if (item["logo"].ToString() != "" && item["logo"].ToString() != "null")
                        {
                            byte[] imagen = (byte[])(item["logo"]);

                            MemoryStream ms = new MemoryStream(imagen);
                            pbxLogo.Image = Image.FromStream(ms);
                        }
                    }
                }
                else
                {
                    UtilityFrm.mensajeError("No existen Datos de la Empresa Cargados");

                    this.activarControles();
                }
            }
            catch (Exception ex)
            {
                UtilityFrm.mensajeError("Error: " + ex.Message + " " + ex.StackTrace);
            }
        }