private void corDeFundoToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult dlg1 = new DialogResult(); if (this.BackgroundImage != null) { dlg1 = MessageBox.Show("Deseja Descartar o papel de parede atual?", "Cor de Fundo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); } if ((dlg1 == DialogResult.Yes) || (dlg1 == DialogResult.None)) { Perfil perfil = new Perfil(); PerfilBLL perfilbll = new PerfilBLL(); colorDialog1.ShowDialog(); this.BackColor = colorDialog1.Color; perfil.Cor = ColorTranslator.ToHtml(this.BackColor); perfilbll.SalvarCor(perfil); this.BackgroundImage = null; } }
private void FrmUsuario_Load(object sender, EventArgs e) { try { txtRepetirContrasenia.Text = ""; cmbPerfil.DisplayMember = "Perfil"; cmbPerfil.ValueMember = "Id"; PerfilBLL miPerfilBLL = new PerfilBLL(); cmbPerfil.DataSource = miPerfilBLL.obtenerPerfiles(); UsuarioBLL miUsuarioBLL = new UsuarioBLL(); DataSet ds = miUsuarioBLL.listado(); dt = ds.Tables[0]; dgvUsuarios.DataSource = dt; // dgvUsuarios.Enabled = false; if (dt.Rows.Count > 0) { lblDatosNoEncontrados.Visible = false; dgvUsuarios_CellClick(null, null); } else { lblDatosNoEncontrados.Visible = true; } MostrarGuardarCancelar(false); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
public string EditarPerfil(MLL.Perfil perfil, FormCollection form) { PerfilBLL perBLL = new PerfilBLL(); return(perBLL.EditarPerfil(perfil, form).ToString()); }
/// <summary> /// José Oñate:: /// Separación del método registrar para generar mayor orden visual /// </summary> private void registrar() { String[] separadorRut = txtRut.Text.Split('-'); UsuarioBEL usuBEL = new UsuarioBEL(); usuBEL.Rut = Int32.Parse(separadorRut[0]); usuBEL.Contrasena = txtContrasena.Text; usuBEL.IdTipoPerfil = 1; PerfilBLL perBLL = new PerfilBLL(); perBLL.agregarUsuario(usuBEL); DireccionBEL direccionBEL = new DireccionBEL(); direccionBEL.Nombre = txtDireccion.Text; direccionBEL.Numero = Int32.Parse(txtnumero.Text); direccionBEL.Id_comuna = Int32.Parse(ddlComuna.SelectedItem.Value); DireccionBLL direccionBLL = new DireccionBLL(); int id_direccion = direccionBLL.agregarDireccion(direccionBEL); ClienteBEL clienteBEL = new ClienteBEL(); clienteBEL.Rut = Int32.Parse(separadorRut[0]); clienteBEL.Dv = Char.Parse(separadorRut[1]); clienteBEL.Nombre = txtNombre.Text; clienteBEL.Apellido = txtApellidos.Text; if (rblSexo.SelectedItem.Text == "Masculino") { clienteBEL.Sexo = Char.Parse(rblSexo.SelectedItem.Value); } else { clienteBEL.Sexo = Char.Parse(rblSexo.SelectedItem.Value); } clienteBEL.Correo = txtCorreo.Text; if (chbCell.Checked) { clienteBEL.Celular = Int32.Parse(txtCell.Text); } else { clienteBEL.Celular = Int32.Parse(txtTelefono.Text); } clienteBEL.Bloqueado = 0; ClienteBLL clienteBLL = new ClienteBLL(); clienteBLL.registroCliente(clienteBEL); UsuarioPerfilesBEL usuperBEL = new UsuarioPerfilesBEL(); usuperBEL.Rut = Int32.Parse(separadorRut[0]); usuperBEL.Id_tipo_perfil = 1; UsuarioPerfilesBLL usuperBLL = new UsuarioPerfilesBLL(); usuperBLL.agregarUsuarioPerfiles(usuperBEL); ClienteDireccionesBEL clidirBEL = new ClienteDireccionesBEL(); clidirBEL.Rut_cliente = Int32.Parse(separadorRut[0]);; clidirBEL.Id_direccion = id_direccion; clidirBEL.Primaria = 'S'; ClienteDireccionesBLL clidirBLL = new ClienteDireccionesBLL(); clidirBLL.agregarUsuarioDirecciones(clidirBEL); }
protected override void ordenaCelula(object sender, DataGridViewCellMouseEventArgs e) { base.ordenaCelula(sender, e); PerfilBLL = new PerfilBLL(); DataGridViewColumn col = dgvFiltro.Columns[e.ColumnIndex]; DataGridViewColumn colAnt = dgvFiltro.Columns[colOrdem]; ListSortDirection direction; switch (col.HeaderCell.SortGlyphDirection) { case SortOrder.None: direction = ListSortDirection.Ascending; break; case SortOrder.Ascending: direction = ListSortDirection.Ascending; break; case SortOrder.Descending: direction = ListSortDirection.Descending; break; default: direction = ListSortDirection.Ascending; break; } if (colOrdem == e.ColumnIndex) { if (direction == ListSortDirection.Ascending) { direction = ListSortDirection.Descending; } else { direction = ListSortDirection.Ascending; col.HeaderCell.SortGlyphDirection = SortOrder.None; } } else { direction = ListSortDirection.Ascending; colAnt.HeaderCell.SortGlyphDirection = SortOrder.None; } switch (e.ColumnIndex) { case 1: { List <Perfil> PerfilList = PerfilBLL.getPerfil(p => p.nome, direction != ListSortDirection.Ascending, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = PerfilList; } break; case 2: { List <Perfil> PerfilList = PerfilBLL.getPerfil(p => p.descricao, direction != ListSortDirection.Ascending, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = PerfilList; } break; case 3: { List <Perfil> PerfilList = PerfilBLL.getPerfil(p => p.inclusao.ToString(), direction != ListSortDirection.Ascending, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = PerfilList; } break; case 4: { List <Perfil> PerfilList = PerfilBLL.getPerfil(p => p.usuario_inclusao, direction != ListSortDirection.Ascending, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = PerfilList; } break; case 5: { List <Perfil> PerfilList = PerfilBLL.getPerfil(p => p.alteracao.ToString(), direction != ListSortDirection.Ascending, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = PerfilList; } break; case 6: { List <Perfil> PerfilList = PerfilBLL.getPerfil(p => p.usuario_alteracao, direction != ListSortDirection.Ascending, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = PerfilList; } break; //O default será executado quando o index for 0 default: { List <Perfil> PerfilList = PerfilBLL.getPerfil(p => p.Id.ToString(), direction != ListSortDirection.Ascending, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = PerfilList; } break; } colOrdem = e.ColumnIndex; col.HeaderCell.SortGlyphDirection = direction == ListSortDirection.Ascending ? SortOrder.Ascending : SortOrder.Descending; }
/// <summary> /// José Oñate:: /// Método para validar selección de al menos 1 interés. /// </summary> /// <returns></returns> /*private bool selInteres() * { * bool selecciona = false; * int contador = 0; * * foreach (ListItem item in chkIntereses.Items) * { * if (item.Selected) contador++; * } * * if (contador != 0) selecciona = true; * * return selecciona; * }*/ /// <summary> /// José Oñate:: /// Separación del método registrar para generar mayor orden visual /// </summary> private void registrar() { String[] separadorRut = txtRut.Text.Split('-'); /*ProductorHabilitadoBLL prohabBLL = new ProductorHabilitadoBLL(); * ProductorHabilitadoBEL prohab = prohabBLL.Productor_Habilitados_Sel(Int32.Parse(separadorRut[0])); * * if (prohab.Rut != -1) * { * txtApellidos.Text = prohab.Apellido; * txtNombre.Text = prohab.Nombre; * * } * * * ProductorHabilitadoBEL prohabBEL = new ProductorHabilitadoBEL();*/ UsuarioBEL usuBEL = new UsuarioBEL(); usuBEL.Rut = Int32.Parse(separadorRut[0]); usuBEL.Contrasena = txtContrasena.Text; usuBEL.IdTipoPerfil = 2; PerfilBLL perBLL = new PerfilBLL(); perBLL.agregarUsuario(usuBEL); DireccionBEL direccionBEL = new DireccionBEL(); direccionBEL.Nombre = txtDireccion.Text; direccionBEL.Numero = Int32.Parse(txtnumero.Text); direccionBEL.Id_comuna = Int32.Parse(ddlComuna.SelectedItem.Value); DireccionBLL direccionBLL = new DireccionBLL(); int id_direccion = direccionBLL.agregarDireccion(direccionBEL); if (chkNegocio.Checked) { DireccionBEL direccionNegBEL = new DireccionBEL(); direccionNegBEL.Nombre = txtDireccionNegocio.Text; direccionNegBEL.Numero = Int32.Parse(txtNumeroNegocio.Text); direccionNegBEL.Id_comuna = Int32.Parse(ddlComunaNegocio.SelectedItem.Value); DireccionBLL direccionNegBLL = new DireccionBLL(); int id_direccionNeg = direccionNegBLL.agregarDireccion(direccionNegBEL); ProductorBEL productorBEL = new ProductorBEL(); productorBEL.Rut = Int32.Parse(separadorRut[0]); productorBEL.Dv = Char.Parse(separadorRut[1]); productorBEL.Nombre = txtNombre.Text; productorBEL.Apellido = txtApellidos.Text; productorBEL.Sexo = Char.Parse(txtSexo.Text); productorBEL.Id_direccionparticular = id_direccion; if (chbCell.Checked) { productorBEL.Celular = Int32.Parse(txtCell.Text); } else { productorBEL.Celular = Int32.Parse(txtTelefono.Text); } productorBEL.Correo = txtCorreo.Text; productorBEL.Id_direccionnegocio = id_direccionNeg; productorBEL.Mismadireccion = 0; ProductorBLL productorBLL = new ProductorBLL(); productorBLL.registroProductor(productorBEL); } else { ProductorBEL productorBEL = new ProductorBEL(); productorBEL.Rut = Int32.Parse(separadorRut[0]); productorBEL.Dv = Char.Parse(separadorRut[1]); productorBEL.Nombre = txtNombre.Text; productorBEL.Apellido = txtApellidos.Text; productorBEL.Sexo = Char.Parse(txtSexo.Text); productorBEL.Id_direccionparticular = id_direccion; if (chbCell.Checked) { productorBEL.Celular = Int32.Parse(txtCell.Text); } else { productorBEL.Celular = Int32.Parse(txtTelefono.Text); } productorBEL.Correo = txtCorreo.Text; productorBEL.Id_direccionnegocio = id_direccion; productorBEL.Mismadireccion = 1; ProductorBLL productorBLL = new ProductorBLL(); productorBLL.registroProductor(productorBEL); } UsuarioPerfilesBEL usuperBEL = new UsuarioPerfilesBEL(); usuperBEL.Rut = Int32.Parse(separadorRut[0]); usuperBEL.Id_tipo_perfil = 1; UsuarioPerfilesBLL usuperBLL = new UsuarioPerfilesBLL(); usuperBLL.agregarUsuarioPerfiles(usuperBEL); }