private void btnBuscar_Click(object sender, EventArgs e) { PerfilesBE Perfil = new PerfilesBE(); try { frmPerfilConsulta ofrm = new frmPerfilConsulta(); ofrm.WindowState = FormWindowState.Normal; ofrm.StartPosition = FormStartPosition.CenterScreen; ofrm.MaximizeBox = false; ofrm.MinimizeBox = false; ofrm.Titulo = "BUSCAR DESCRIPCIÓN DE PUESTO"; ofrm.ShowDialog(); Perfil = ofrm.Perfil; if (Perfil != null) { LimpiarCampos(); cboEntidad.SelectedValue = Perfil.Puesto.Departamentos.Entidades.Id; cboDepto.SelectedValue = Perfil.Puesto.Departamentos.Id; cboPuestos.SelectedValue = Perfil.Puesto.Id; } } catch (Exception ex) { RadMessageBox.Show("Ocurrió un error al realiza la búsqueda\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error); } }
public int Actualizar(PerfilesBE e_Perfiles) { using (SqlConnection connection = Conectar(m_BaseDatos)) { try { ComandoSP("usp_PerfilesActualizar", connection); ParametroSP("@PerfilId", e_Perfiles.PerfilesId); ParametroSP("@PerfilKey", e_Perfiles.PerfilKey); ParametroSP("@Nombre", e_Perfiles.Nombre); ParametroSP("@Descripcion", e_Perfiles.Descripcion); ParametroSP("@EstadoID", e_Perfiles.EstadoId); ParametroSP("@UsuarioModificacionRegistro", e_Perfiles.UsuarioModificacionRegistro); ParametroSP("@NroIpRegistro", e_Perfiles.NroIpRegistro); return(comando.ExecuteNonQuery()); } catch (SqlException ex) { throw new Exception("Clase DataAccess " + Nombre_Clase + "\r\n" + "Descripción: " + ex.Message); } finally { connection.Dispose(); } } }
public List <PerfilesBE> Listar_grilla(PerfilesBE ent) { List <PerfilesBE> lst = new List <PerfilesBE>(); using (SqlConnection connection = Conectar(m_BaseDatos)) { try { ComandoSP("usp_PERFILConsultar_Lista_Grilla", connection); ParametroSP("@accion", "lst"); ParametroSP("@opcion", "lst_grilla"); ParametroSP("@Nombre", ent.Nombre); ParametroSP("@PerfilId", ent.PerfilesId); using (SqlDataReader reader = comando.ExecuteReader()) { while (reader.Read()) { lst.Add(new PerfilesBE(reader)); } } } catch (SqlException ex) { throw new Exception("Clase DataAccess: " + Nombre_Clase + "\r\n" + "Descripción: " + ex.Message); } finally { connection.Dispose(); } } return(lst); }
public bool Insertar(PerfilesBE e_Perfiles) { try { PerfilesDA o_Perfiles = new PerfilesDA(m_BaseDatos); int resp = o_Perfiles.Insertar(e_Perfiles); return(resp > 0); } catch (Exception ex) { throw new Exception("Clase Business: " + Nombre_Clase + "\r\n" + "Descripción: " + ex.Message); } }
public List <PerfilesBE> Listar_grilla(PerfilesBE ent) { List <PerfilesBE> l = new List <PerfilesBE>(); try { l = (new PerfilesDA()).Consultar_Lista(); } catch (Exception ex) { throw new Exception("Clase Business: " + Nombre_Clase + "\r\n" + "Descripción: " + ex.Message); } return(l); }
public bool Actualizar() { String out_sms_err = ""; bool v = false; PerfilesBE perfilesBE = new PerfilesBE(); perfilesBE = ViewModelToBE(this); v = (new PerfilesBL()).Actualizar(perfilesBE, ref out_sms_err); if (v == false) { this.ErrorSms = out_sms_err; } return(v); }
private PerfilesBE ViewModelToBE(PerfilesViewModel vm) { PerfilesBE m_perfilesBE = new PerfilesBE(); m_perfilesBE.PerfilesId = vm.PerfilesId; m_perfilesBE.Nombre = vm.Nombre; m_perfilesBE.Descripcion = vm.Descripcion; m_perfilesBE.EstadoId = vm.EstadoId; m_perfilesBE.UsuarioRegistro = vm.UsuarioRegistroNombre; m_perfilesBE.FechaRegistro = vm.FechaRegistro; m_perfilesBE.FechaModificacionRegistro = vm.FechaModificacionRegistro; m_perfilesBE.UsuarioModificacionRegistro = vm.UsuarioModificacionRegistroNombre; m_perfilesBE.NroIpRegistro = HttpContext.Current.Request.UserHostAddress; return(m_perfilesBE); }
public bool Eliminar(int id) { PerfilesBE e_PERFIL = new PerfilesBE() { PerfilesId = id }; try { int resp = (new PerfilesDA()).Anular(e_PERFIL); return(resp > 0); } catch (Exception ex) { throw new Exception("Clase Business: " + Nombre_Clase + "\r\n" + "Descripción: " + ex.Message); } }
public bool Actualizar(PerfilesBE e_PERFIL, ref string outSMS) { if (ValidarActualizar(e_PERFIL, ref outSMS) == false) { return(false); } try { PerfilesDA o_PERFIL = new PerfilesDA(); int resp = o_PERFIL.Actualizar(e_PERFIL); return(resp > 0); } catch (Exception ex) { throw new Exception("Clase Business: " + Nombre_Clase + "\r\n" + "Descripción: " + ex.Message); } }
public bool Insertar(PerfilesBE e_PERFIL, ref String out_sms) { if (ValidarInsertar(e_PERFIL, ref out_sms) == false) { return(false); } try { PerfilesDA o_PERFIL = new PerfilesDA(); int resp = o_PERFIL.Insertar(e_PERFIL); return(resp > 0); } catch (Exception ex) { out_sms = "Ocurrió un error al insertar registro"; throw new Exception("Clase Business: " + Nombre_Clase + "\r\n" + "Descripción: " + ex.Message); } }
//public bool Actualizar() //{ // bool v = false; // String sms = ""; // PerfilesBE ent = new PerfilesBE(); // ent.PerfilesId = this.PerfilesId; // ent.Nombre = this.Nombre.ToUpper(); // ent.Descripcion = this.Descripcion; // ent.EstadoId= this.EstadoId; // ent.UsuarioRegistro= this.UsuarioRegistroNombre; // ent.UsuarioModificacionRegistro= this.UsuarioModificacionRegistroNombre; // ent.FechaRegistro = this.FechaRegistro; // ent.FechaModificacionRegistro = this.FechaModificacionRegistro; // v = (new PerfilesBL()).Actualizar(ent, ref sms); // if (v == false) // this.ErrorSms = sms; // return v; //} //public bool Insertar() //{ // bool v = false; // String sms = ""; // PerfilesBE ent = new PerfilesBE(); // ent.PerfilesId = this.PerfilesId; // ent.Nombre = this.Nombre.ToUpper(); // ent.Descripcion = this.Descripcion; // ent.EstadoId = this.EstadoId; // ent.UsuarioRegistro = this.UsuarioRegistroNombre; // ent.UsuarioModificacionRegistro = this.UsuarioModificacionRegistroNombre; // ent.FechaRegistro = this.FechaRegistro; // ent.FechaModificacionRegistro = this.FechaModificacionRegistro; // v = (new PerfilesBL()).Insertar(ent, ref sms); // if (v == false) // this.ErrorSms = sms; // return v; //} private PerfilesViewModel BEToViewModel(PerfilesBE m_perfilesBE) { PerfilesViewModel vm = new PerfilesViewModel(); vm.PerfilesId = m_perfilesBE.PerfilesId; vm.Nombre = m_perfilesBE.Nombre; vm.Descripcion = m_perfilesBE.Descripcion; vm.EstadoId = m_perfilesBE.EstadoId; vm.EstadoNombre = new EstadosBL().Consultar_Lista().Where(x => x.EstadoId == m_perfilesBE.EstadoId).First().Nombre; if (m_perfilesBE.UsuarioRegistro != null) { vm.UsuarioRegistroId = new UsuariosBL().Consultar_Lista().Where(x => x.Login == m_perfilesBE.UsuarioRegistro).First().UsuarioId; } vm.FechaRegistro = m_perfilesBE.FechaRegistro; vm.FechaModificacionRegistro = m_perfilesBE.FechaModificacionRegistro; vm.UsuarioRegistroNombre = m_perfilesBE.UsuarioRegistro; vm.UsuarioModificacionRegistroNombre = m_perfilesBE.UsuarioModificacionRegistro; return(vm); }
//public bool Eliminar(int id) //{ // bool v = false; // if (id < 0) return false; // PerfilesBE ent = new PerfilesBE(); // ent.PerfilesId = id; // v = (new PerfilesBL()).Eliminar(id); // if (v == false) // this.ErrorSms = "No se pudo eliminar el registro, posiblemente ya ha sido referenciado."; // return v; //} public void BuscarPorId(int id) { if (id < 0) { return; } PerfilesBE m_perfilesBE = new PerfilesBE(); PerfilesBE perfilesBE = new PerfilesBL().Consultar_Lista().Where(x => x.PerfilesId == id).First(); this.PerfilesId = perfilesBE.PerfilesId; this.Nombre = perfilesBE.Nombre; this.Descripcion = perfilesBE.Descripcion; this.EstadoId = perfilesBE.EstadoId; this.EstadoNombre = new EstadosBL().Consultar_Lista().Where(x => x.EstadoId == perfilesBE.EstadoId).First().Descripcion; this.UsuarioRegistroId = new UsuariosBL().Consultar_Lista().Where(x => x.Login == perfilesBE.UsuarioRegistro).First().UsuarioId; this.FechaRegistro = perfilesBE.FechaRegistro; this.FechaModificacionRegistro = perfilesBE.FechaModificacionRegistro; this.UsuarioRegistroNombre = perfilesBE.UsuarioRegistro; this.UsuarioModificacionRegistroNombre = perfilesBE.UsuarioModificacionRegistro; }
public List <PerfilesBE> CHU_Perfil_Consulta(PerfilesBE Item) { List <PerfilesBE> oList = new List <PerfilesBE>(); try { using (SqlConnection conn = new SqlConnection(RecuperarCadenaDeConexion("coneccionSQL"))) { conn.Open(); using (SqlCommand cmd = new SqlCommand(CONST_USP_CHU_PERFIL_CONSULTA, conn)) { cmd.Parameters.AddWithValue("@Perfil", Item.Sel); cmd.Parameters.AddWithValue("@IdEntidad", Item.Puesto.Departamentos.Entidades.Id); cmd.Parameters.AddWithValue("@IdDepto", Item.Puesto.Departamentos.Id); cmd.Parameters.AddWithValue("@IdPuesto", Item.Puesto.Id); cmd.CommandType = CommandType.StoredProcedure; using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { PerfilesBE obj = new PerfilesBE(); obj.Id = int.Parse(reader["PER_Id"].ToString()); obj.Puesto.Departamentos.Entidades.Id = int.Parse(reader["ENT_Id"].ToString()); obj.Puesto.Departamentos.Id = int.Parse(reader["DEP_Id"].ToString()); obj.Puesto.Id = int.Parse(reader["PUE_Id"].ToString()); obj.Puesto.Departamentos.Entidades.Nombre = reader["ENT_Nombre"].ToString(); obj.Puesto.Departamentos.Nombre = reader["DEP_Nombre"].ToString(); obj.Puesto.Nombre = reader["PUE_Nombre"].ToString(); oList.Add(obj); } } } } return(oList); } catch (Exception ex) { throw ex; } }
private bool ValidarActualizar(PerfilesBE e_PERFIL, ref string outSms) { bool v = true; if (e_PERFIL.Nombre == null || e_PERFIL.Nombre == "") { outSms = outSms + "Ingrese perfil"; v = false; } List <PerfilesBE> l = (new PerfilesBL()).Consultar_Lista().Where(x => x.Nombre.Equals(e_PERFIL.Nombre)).ToList(); if (l.Count > 0) { if (l[0].PerfilesId != e_PERFIL.PerfilesId) { outSms = outSms + "Ya existe registro con la descripción " + e_PERFIL.Nombre; v = false; } } return(v); }
public int CHU_Perfiles_Actualiza(PerfilesBE obj, DataTable Detalle) { int Result = 0; try { using (SqlConnection conn = new SqlConnection(RecuperarCadenaDeConexion("coneccionSQL"))) { conn.Open(); using (SqlCommand cmd = new SqlCommand(CONST_USP_CHU_PERFILES_ACTUALIZA, conn)) { cmd.Parameters.AddWithValue("@IdPerfil", obj.Id); cmd.Parameters.AddWithValue("@Experiencia", obj.Experiencia); cmd.Parameters.AddWithValue("@SueldoMax", obj.SueldoMax); cmd.Parameters.AddWithValue("@Detalle", Detalle); cmd.Parameters.AddWithValue("@IdUsuario", obj.DatosUsuario.IdUsuarioCreo); cmd.CommandType = CommandType.StoredProcedure; Result = Convert.ToInt32(cmd.ExecuteScalar()); } } return(Result); } catch (Exception ex) { throw ex; } }
private void btnBuscar_Click(object sender, EventArgs e) { oCHumano = new WCF_CHumano.Hersan_CHumanoClient(); try { PerfilesBE obj = new PerfilesBE(); obj.Sel = this.Text.Contains("PERFIL"); obj.Puesto.Departamentos.Entidades.Id = cboEntidad.Enabled ? int.Parse(cboEntidad.SelectedValue.ToString()) : 0; obj.Puesto.Departamentos.Id = cboDepto.Enabled ? int.Parse(cboDepto.SelectedValue.ToString()) : 0; obj.Puesto.Id = cboPuesto.Enabled ? int.Parse(cboPuesto.SelectedValue.ToString()) : 0; oList = oCHumano.CHU_Perfil_Consulta(obj); gvDatos.DataSource = oList; if (oList.Count == 0) { RadMessageBox.Show("No se han encontrado datos con los criterios seleccionados", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info); } } catch (Exception ex) { RadMessageBox.Show("Ocurrió un error al cargar la información\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error); } finally { oCHumano = null; } }
private bool ValidarInsertar(PerfilesBE e_PERFIL, ref string outSms) { bool v = true; if (e_PERFIL.Nombre == null || e_PERFIL.Nombre == "") { outSms = outSms + "Ingrese la descripción del perfil"; v = false; } PerfilesBE dto = new PerfilesBE(); dto.Nombre = e_PERFIL.Nombre; List <PerfilesBE> l = (new PerfilesBL()).Consultar_Lista().Where(x => x.Nombre.Equals(e_PERFIL.Nombre)).ToList(); if (l.Count > 0) { outSms = outSms + "Ya existe registro con la descripción " + e_PERFIL.Nombre; v = false; } return(v); }
private void btnGuardar_Click(object sender, EventArgs e) { if (grdDatos.Rows.Count < 1 || grdDatosEdu.Rows.Count < 1) { RadMessageBox.Show("Debe de agregar estudios y competencias al perfil...\n", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info); return; } oCHumano = new WCF_CHumano.Hersan_CHumanoClient(); DataTable oData = new DataTable("Datos"); try { oData.Columns.Add("Id"); oData.Columns.Add("Concepto"); oData.Columns.Add("Tipo"); oData.Columns.Add("Valor"); oData.Columns.Add("Estatus"); PerfilesBE obj = new PerfilesBE(); oList.ForEach(item => { obj.Id = txtId.Text.Trim().Length > 0 ? int.Parse(txtId.Text) : 0; obj.Puesto.Departamentos.Id = int.Parse(cboDepto.SelectedValue.ToString()); obj.Puesto.Id = int.Parse(cboPuestos.SelectedValue.ToString()); obj.Experiencia = cboExperiencia.Text; obj.SueldoMax = decimal.Parse(txtSueldo.Text); obj.DatosUsuario.IdUsuarioCreo = BaseWinBP.UsuarioLogueado.ID; #region Carga Detalle DataRow oRow = oData.NewRow(); if (item.Grupo.Contains("EDUCACIÓN")) { oRow["Id"] = item.Id; oRow["Concepto"] = "EDUCACIÓN"; oRow["Tipo"] = item.Tipo; oRow["Valor"] = item.Valor; oRow["Estatus"] = item.DatosUsuario.Estatus; } if (item.Grupo.Contains("COMPETENCIAS")) { oRow["Id"] = item.Id; oRow["Concepto"] = "COMPETENCIAS"; oRow["Tipo"] = item.Tipo; oRow["Valor"] = item.Valor; oRow["Estatus"] = item.DatosUsuario.Estatus; } oData.Rows.Add(oRow); #endregion }); if (RadMessageBox.Show("Desea guardar los datos capturados...?", this.Text, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) { /* ALTA DE PERFIL */ if (int.Parse(txtId.Text) == 0) { int Result = oCHumano.CHU_Perfiles_Guardar(obj, oData); if (Result != 0) { RadMessageBox.Show("Perfil guardado correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info); } else { RadMessageBox.Show("Ocurrió un error al guardar el perfil", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error); } } else { int Result = oCHumano.CHU_Perfiles_Actualiza(obj, oData); if (Result != 0) { RadMessageBox.Show("Perfil actualizado correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info); } else { RadMessageBox.Show("Ocurrió un error al actualizar el perfil", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error); } } LimpiarCampos(); cboEntidad.SelectedIndex = 0; } } catch (Exception ex) { RadMessageBox.Show("Ocurrió un error al guardar el perfil\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error); } finally { oCHumano = null; } }
public int CHU_Perfiles_Guardar(PerfilesBE obj, DataTable Detalle) { return(new PerfilesBP().CHU_Perfiles_Guardar(obj, Detalle)); }
public int CHU_Perfiles_Actualiza(PerfilesBE obj, DataTable Detalle) { return(new PerfilesBP().CHU_Perfiles_Actualiza(obj, Detalle)); }
public List <PerfilesBE> CHU_Perfil_Consulta(PerfilesBE Item) { return(new PerfilesBP().CHU_Perfil_Consulta(Item)); }
private void btnGuardar_Click(object sender, EventArgs e) { oCHumano = new WCF_CHumano.Hersan_CHumanoClient(); DataTable oData = new DataTable("Datos"); try { oData.Columns.Add("Id"); oData.Columns.Add("Concepto"); oData.Columns.Add("Tipo"); oData.Columns.Add("Estatus"); PerfilesBE obj = new PerfilesBE(); oList.ForEach(item => { obj.Id = int.Parse(txtId.Text); obj.Puesto.Departamentos.Id = int.Parse(cboDepto.SelectedValue.ToString()); obj.Puesto.Id = int.Parse(cboPuestos.SelectedValue.ToString()); obj.Experiencia = cboExperiencia.Text; obj.DatosUsuario.IdUsuarioCreo = BaseWinBP.UsuarioLogueado.ID; #region Carga Detalle DataRow oRow = oData.NewRow(); if (item.Grupo.Contains("EDUCACIÓN")) { oRow["Id"] = item.Id; oRow["Concepto"] = "EDUCACIÓN"; oRow["Tipo"] = item.Tipo; oRow["Estatus"] = item.DatosUsuario.Estatus; } if (item.Grupo.Contains("FUNCIONES")) { oRow["Id"] = item.Id; oRow["Concepto"] = "FUNCIONES"; oRow["Tipo"] = string.Empty; oRow["Estatus"] = item.DatosUsuario.Estatus; } if (item.Grupo.Contains("COMPETENCIAS")) { oRow["Id"] = item.Id; oRow["Concepto"] = "COMPETENCIAS"; oRow["Tipo"] = string.Empty; oRow["Estatus"] = item.DatosUsuario.Estatus; } oData.Rows.Add(oRow); #endregion }); /* ALTA DE PERFIL */ if (int.Parse(txtId.Text) == 0) { int Result = oCHumano.CHU_Perfiles_Guardar(obj, oData); if (Result != 0) { RadMessageBox.Show("Perfil guardado correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info); } else { RadMessageBox.Show("Ocurrió un error al guardar el perfil", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error); } } else { int Result = oCHumano.CHU_Perfiles_Actualiza(obj, oData); if (Result != 0) { RadMessageBox.Show("Perfil actualizado correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info); } else { RadMessageBox.Show("Ocurrió un error al actualizar el perfil", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error); } } LimpiarCampos(); } catch (Exception ex) { RadMessageBox.Show("Ocurrió un error al guardar el perfil\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error); } finally { oCHumano = null; } }