private void Borrar() { try { oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "1200504"); if (oFuncion.Err) { MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else { if (MessageBox.Show("Esta seguro de Borrar este Registro", "Atencion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { App_Code.Sistema.Sistema_Grupos oRegistro = new App_Code.Sistema.Sistema_Grupos(int.Parse(this.lblFicha.Text.ToString())); if (oRegistro.Nombre == "Administrador" || oRegistro.Nombre == "Desarrollo") { MessageBox.Show("Disculpe Usted No Puede Borrar Grupos Predeterminados Del Sistema", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { oRegistro.Eliminar(); this.Nuevo(); MessageBox.Show(oRegistro.Msg, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch (Exception) { } }
private void Presentar(int id) { App_Code.Sistema.Sistema_Grupos oRegistro = new App_Code.Sistema.Sistema_Grupos(id); this.lblFicha.Text = oRegistro.Id.ToString("0"); this.txtCodigo.Text = oRegistro.Codigo; this.txtNombre.Text = oRegistro.Nombre; oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "1200504"); if (!oFuncion.Err) { this.btnEliminar.Enabled = true; } }
public void CargoDatos(string codigo) { //Busquedad de los datos de la empresa seleccionada DataTable oEmpresa = new App_Code.Sistema.Sistema_Empresas().Buscar( 1, "id,nombre,cadena_conexion,codigo", "codigo = '" + codigo + "'", ""); if (oEmpresa.Rows.Count > 0) { DataRow oRow = oEmpresa.Rows[0]; conexion = oRow["cadena_conexion"].ToString(); sql = oRow["cadena_conexion"].ToString(); MessageBox.Show("Conexión a Base de Datos Exitosa Bienvenido", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); App_Code.Configuracion.Empresa oE = new App_Code.Configuracion.Empresa((string)oRow["codigo"]); App_Code.Sistema.Sistema_Grupos oGrupo = new App_Code.Sistema.Sistema_Grupos(id_grupo_usuario); this.lblGrupo.Text = oGrupo.Nombre; this.lblIdGrupo.Text = oGrupo.Id.ToString(); this.lblIdEmpresa.Text = oE.Id.ToString(); id_empresa = oE.Id; codigo = oE.Codigo.ToString(); this.Text = oE.Nombre.ToUpper() + " - Rif: " + oE.Rif.ToUpper() + " (" + oE.Codigo.ToString() + ")"; if (oE.Imagen == "Ninguna" || oE.Imagen == null) { this.campoImagen.Image = Properties.Resources.Factory; } else { try { this.campoImagen.Image = Image.FromFile(dest + oE.Imagen); } catch (Exception) { this.campoImagen.Image = Properties.Resources.Factory; } } this.lblIdU.Text = id_usuario.ToString(); this.lblNombreUsuario.Text = usuario; this.lblIdEmpresa.Text = id_empresa.ToString(); } }
private void Guardar() { App_Code.Sistema.Sistema_Grupos oRegistro = new App_Code.Sistema.Sistema_Grupos(int.Parse(this.lblFicha.Text)); oRegistro.Codigo = this.txtCodigo.Text.ToString().ToUpper(); oRegistro.Nombre = this.txtNombre.Text.ToString().ToUpper(); try { if (!Validar()) { if (oRegistro.Err) { oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "1200502"); if (oFuncion.Err) { MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else { oRegistro.Insertar(); } } else { oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "1200503"); if (oFuncion.Err) { MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else { oRegistro.Actualizar(); } } MessageBox.Show(oRegistro.Msg, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Consulta(); this.Presentar(oRegistro.Id); } } catch (Exception) { } }
private void btnIngresar_Click(object sender, EventArgs e) { if (!Validar()) { DataTable oTabla = new App_Code.Sistema.Sistema_Usuarios().Buscar( 1, "id,nombre,apellido,grupo_id,empresa_id,estatus", "(usuario = '" + this.txtUsuario.Text + "') AND (clave = '" + this.txtClave.Text + "')", ""); if (oTabla.Rows.Count > 0) { if ((oTabla.Rows[0]["estatus"].ToString()) == "Bloqueado") { MessageBox.Show("Disculpe usuario bloqueado", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { App_Code.Sistema.Sistema_Grupos oGrupo = new App_Code.Sistema.Sistema_Grupos(int.Parse(oTabla.Rows[0]["grupo_id"].ToString())); frmPrincipal.id_usuario = int.Parse(oTabla.Rows[0]["id"].ToString()); frmPrincipal.usuario = oTabla.Rows[0]["apellido"].ToString().ToUpper() + " " + oTabla.Rows[0]["nombre"].ToString().ToUpper(); frmPrincipal.id_grupo_usuario = int.Parse(oTabla.Rows[0]["grupo_id"].ToString()); if (oGrupo.Nombre == "Administrador" || oGrupo.Nombre == "Desarrollo") { panterasoftware.Configuracion.frmSelEmpresa oEmpresa = new panterasoftware.Configuracion.frmSelEmpresa(); oEmpresa.Show(); this.Hide(); } else { App_Code.Sistema.Sistema_Empresas oEmpresa = new App_Code.Sistema.Sistema_Empresas(int.Parse(oTabla.Rows[0]["empresa_id"].ToString())); frmPrincipal oPrincipal = new frmPrincipal(); frmPrincipal.id_empresa = oEmpresa.Id; frmPrincipal.codigo = oEmpresa.Codigo; oPrincipal.Show(); this.Hide(); } } } else { MessageBox.Show("Disculpe usuario o contraseña incorrecta", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void Presentar(int id) { App_Code.Sistema.Sistema_Usuarios oRegistro = new App_Code.Sistema.Sistema_Usuarios(id); App_Code.Sistema.Sistema_Grupos oGrupo = new App_Code.Sistema.Sistema_Grupos(oRegistro.GrupoId); this.lblFicha.Text = oRegistro.Id.ToString("0"); this.txtApellidos.Text = oRegistro.Apellido; this.txtNombres.Text = oRegistro.Nombre; this.txtClave.Text = oRegistro.Clave; this.txtRepClave.Text = oRegistro.Clave; this.txtUsuario.Text = oRegistro.Usuario; this.cmbEstatus.Text = oRegistro.Estatus; this.BuscarAsignados(); this.txtUsuario.BackColor = Color.White; this.txtNombres.BackColor = Color.White; this.cmbGrupos.Text = oGrupo.Nombre; oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "1200304"); if (!oFuncion.Err) { this.btnEliminar.Enabled = true; } }
private void Presentar(int id) { App_Code.Sistema.Sistema_Funciones oRegistro = new App_Code.Sistema.Sistema_Funciones(id); App_Code.Sistema.Sistema_Modulos oModulo = new App_Code.Sistema.Sistema_Modulos(oRegistro.ModuloId); App_Code.Sistema.Sistema_Grupos oGrupo = new App_Code.Sistema.Sistema_Grupos(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario); this.lblFicha.Text = oRegistro.Id.ToString("0"); this.txtCodigo.Text = oRegistro.Codigo.ToString(); this.txtNombre.Text = oRegistro.Nombre.ToString(); this.cmbModulo.Text = oModulo.Nombre; this.cmbEstatus.Text = oRegistro.Estatus; this.txtCodigo.Enabled = false; this.txtCodigo.BackColor = Color.White; this.txtNombre.BackColor = Color.White; if (oGrupo.Codigo == "00004") { this.txtCodigo.Enabled = true; } oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "1200104"); if (!oFuncion.Err) { this.btnEliminar.Enabled = true; } }