void GetEmpleado(string codigo = "") { DataTable DTData = null; DataRow fila0 = null; string SSQL = "", id = "0", nombre = "(TODOS)"; ELRMaestros.FormEmpleados frm = new ELRMaestros.FormEmpleados(); try { codigo = codigo.Trim().Replace('-', ' '); if (codigo != "") { SSQL = "SELECT TOP 1 Empleado_Id, Nombres, Apellidos FROM TRRHH_EMPLEADOS"; SSQL += " WHERE Cast(Empleado_Id as Varchar) = '" + codigo + "' "; SSQL += " Or REPLACE(CedulaRNC, '-', '') = '" + codigo + "' "; DTData = objDB.GetSQL(SSQL); if (DTData.Rows.Count > 0) { fila0 = DTData.Rows[0]; } } else { frm.empresaID = empresaID; frm.oficinaID = oficinaID; frm.EsAgregar = false; frm.EsModificar = false; frm.esBusqueda = true; frm.EnEjecusion = true; frm.FiltroEstatico = ""; frm.Text = "EMPLEADOS VENDEDORES"; frm.ShowDialog(); if (frm.filaSelecionada != null) { fila0 = frm.filaSelecionada; } } if (fila0 != null) { id = objUtil.GetAsString("Empleado_Id", fila0); nombre = objUtil.GetAsString("Nombres", fila0); nombre += " " + objUtil.GetAsString("Apellidos", fila0); } txtCodigoEmp.Text = id; txtNombre.Text = nombre; toolTip1.SetToolTip(txtNombre, nombre); GetData(); } catch (Exception ex) { objUtil.MostrarMensajeError(ex.Message); } }
private void btnGarantiaEmpleado_Click(object sender, EventArgs e) { ELRMaestros.FormEmpleados frm = new ELRMaestros.FormEmpleados(); int spReturn = -1; List <DataDB_ELR_NET.Parametro> parms = new List <DataDB_ELR_NET.Parametro>(); string temporalId = ""; int empleadoId = 0; try { frm.empresaID = empresaID; frm.oficinaID = oficinaID; frm.FiltroEstatico = "EsActivo = 1 And Fecha_Baja Is Null"; frm.EsAgregar = false; frm.EsModificar = false; frm.esBusqueda = true; frm.EnEjecusion = true; frm.ShowDialog(); if (frm.filaSelecionada != null) { Cursor = Cursors.WaitCursor; temporalId = objUtil.GetTemporalID(); empleadoId = objUtil.GetAsInt("Empleado_Id", frm.filaSelecionada); parms.Add(new DataDB_ELR_NET.Parametro("empleadoId", empleadoId)); parms.Add(new DataDB_ELR_NET.Parametro("solicitudId", solicitudId)); parms.Add(new DataDB_ELR_NET.Parametro("IdentificadorTemp", temporalId)); parms.Add(new DataDB_ELR_NET.Parametro("autor", nombreUsuario)); objDB.iniciarTransaccion(); spReturn = objDB.EjecutarSP("SP_SOLICITUD_AGREGAR_GARANTIA_EMPLEADO", parms); if (spReturn < 0) { MostrarErrorTemporal(temporalId); objDB.cancelarTransaccion(); } else { Cursor = Cursors.Default; objDB.confirmarTransaccion(); RealizarBusquedaSencilla(); } } } catch (Exception ex) { objUtil.MostrarMensajeError(ex.Message); } finally { Cursor = Cursors.Default; frm.Dispose(); } }
void GetEmpleado(string codigo = "") { DataTable DTData = null; DataRow fila0 = null; string SSQL = ""; ELRMaestros.FormEmpleados frm = new ELRMaestros.FormEmpleados(); try { empleadoId = 0; nombre = "(NO ASIGNADO)"; codigo = codigo.Trim().Replace('-', ' '); if (codigo != "") { SSQL = " SELECT TOP 1 Empleado_Id, Nombres, Apellidos FROM TRRHH_EMPLEADOS"; SSQL += " WHERE Cast(Empleado_Id as Varchar) = '" + codigo + "' "; SSQL += " Or REPLACE(CedulaRNC, '-', '') = '" + codigo + "' "; SSQL += " And EsActivo = 1 And Fecha_Baja Is Null"; DTData = objDB.GetSQL(SSQL); if (DTData.Rows.Count > 0) { fila0 = DTData.Rows[0]; } } else { frm.empresaID = EMPRESA_ID; frm.oficinaID = OFICINA_ID; frm.EsAgregar = false; frm.EsModificar = false; frm.esBusqueda = true; frm.EnEjecusion = true; frm.FiltroEstatico = "EsActivo = 1 And Fecha_Baja Is Null"; frm.Text = "EMPLEADOS (OFICIAL DE CREDITO)"; frm.ShowDialog(); if (frm.filaSelecionada != null) { fila0 = frm.filaSelecionada; } } if (fila0 != null) { empleadoId = objUtil.GetAsInt("Empleado_Id", fila0); nombre = objUtil.GetAsString("Nombres", fila0); nombre += " " + objUtil.GetAsString("Apellidos", fila0); } } catch (Exception ex) { objUtil.MostrarMensajeError(ex.Message); } }
void GetEmpleado(int empleadoId = 0, bool esSupervisor = false) { DataTable DTEmpleado = null; DataRow fila0 = null; ELRMaestros.FormEmpleados frm = new ELRMaestros.FormEmpleados(); try { if (empleadoId > 0) { objDB.AddFiltroIgualA("Empleado_Id", empleadoId.ToString()); objDB.AddFiltroIgualA("EsActivo", "1"); objDB.AddFiltroIgualA("EsVendedor", "1"); DTEmpleado = objDB.GetAll("VEMPLEADOS", 1, objDB.Filtros); if (DTEmpleado.Rows.Count > 0) { fila0 = DTEmpleado.Rows[0]; } } else { frm.nombreUsuario = nombreUsuario; frm.empresaID = EMPRESA_ID; frm.oficinaID = OFICINA_ID; frm.esBusqueda = true; frm.EnEjecusion = true; frm.FiltroEstatico = "EsActivo = 1 And EsVendedor = 1"; frm.Text = esSupervisor ? "ELEGIR SUPERVISOR DE CREDITO" : "ELEGIR OFICIAL DE CREDITO"; frm.ShowDialog(); if (frm.filaSelecionada != null) { fila0 = frm.filaSelecionada; } } //COLOCAMOS DATOS DEL OFICIAL DE CREDITO if (fila0 != null && !esSupervisor) { //txtOficial.Text = objUtil.GetAsString("Empleado_Id", fila0, "0"); //lblOficialNombre.Text = objUtil.GetAsString("Nombre_Completo", fila0, ""); } } catch (Exception ex) { objUtil.MostrarMensajeError(ex.Message); } finally { frm.Dispose(); fila0 = null; DTEmpleado = null; } }
void GetEmpleado() { string codigo = ""; DataTable DTEmpleado = null; DataRow fila0 = null; ELRMaestros.FormEmpleados frm = new ELRMaestros.FormEmpleados(); int departamentoId = 0; int empleadoId = 0; string nombre = ""; try { codigo = txtCodigoEmpleado.Text.Trim(); if (codigo != "") { objDB.LimpiarFiltros(); objDB.AddFiltroIgualA("Empleado_Id", codigo); objDB.AddFiltroIgualA("EsActivo", "1"); objDB.AddFiltroIsNull("Fecha_Baja"); DTEmpleado = objDB.GetAll("VEMPLEADOS", 1, objDB.Filtros); if (DTEmpleado.Rows.Count > 0) { fila0 = DTEmpleado.Rows[0]; } } else { frm.empresaID = EMPRESA_ID; frm.oficinaID = OFICINA_ID; frm.EsAgregar = false; frm.EsModificar = false; frm.Limite = 200; frm.esBusqueda = true; frm.FiltroEstatico = "EsActivo = 1 And Fecha_Baja Is Null"; frm.EnEjecusion = true; frm.ShowDialog(); if (frm.filaSelecionada != null) { fila0 = frm.filaSelecionada; } } if (fila0 != null) { empleadoId = objUtil.GetAsInt("Empleado_Id", fila0); nombre = objUtil.GetAsString("Nombre_Completo", fila0); departamentoId = objUtil.GetAsInt("Departamento_Id", fila0); txtCodigoEmpleado.Text = empleadoId.ToString(); txtNombreEmpleado.Text = nombre; cboDepartamento.SelectedValue = departamentoId; } } catch (Exception ex) { objUtil.MostrarMensajeError(ex.Message); } }
void GetEmpleado(string codigo = "") { ELRMaestros.FormEmpleados frm = new ELRMaestros.FormEmpleados(); DataTable DTEmpleados = null; DataRow fila0 = null; string sfiltro = ""; string nombres = "", apellidos = ""; int id = 0; try { codigo = codigo.Trim().Replace('-', ' '); cedulaRNC = "000000000"; if (codigo != "" && codigo != "0") { objDB.LimpiarFiltros(); objDB.AddFiltroIgualA("Empresa_Id", empresaID.ToString()); sfiltro = "( Cast(Empleado_Id as Varchar) = '" + codigo + "'"; sfiltro += " Or REPLACE(CedulaRNC, '-', '') = '" + codigo + "'"; sfiltro += ")"; objDB.AddFiltroPersonalizado(sfiltro); DTEmpleados = objDB.GetAll("TRRHH_EMPLEADOS", 1, objDB.Filtros); if (DTEmpleados.Rows.Count > 0) { fila0 = DTEmpleados.Rows[0]; } } else { //Realizamos una Busqueda General frm.esBusqueda = true; frm.EsAgregar = false; frm.EsModificar = false; frm.FiltroEstatico = "Empresa_Id = " + empresaID.ToString(); frm.empresaID = empresaID; frm.oficinaID = oficinaID; frm.EnEjecusion = true; frm.ShowDialog(); if (frm.filaSelecionada != null) { fila0 = frm.filaSelecionada; } } id = 0; if (fila0 != null) { id = objUtil.GetAsInt("Empleado_Id", fila0); nombres = objUtil.GetAsString("Nombres", fila0); apellidos = objUtil.GetAsString("Apellidos", fila0); cedulaRNC = objUtil.GetAsString("CedulaRNC", fila0); } txtEmpleadoId.Text = id.ToString(); txtNombre.Text = (nombres + " " + apellidos).Trim(); txtCedulaRNC.Text = cedulaRNC; } catch (Exception ex) { objUtil.MostrarMensajeError("Error al Buscar Cliente, " + ex.Message); } finally { frm.Dispose(); DTEmpleados = null; fila0 = null; } }
void GetVendedor(int tipo = 0) { ELRMaestros.FormEmpleados frm = new ELRMaestros.FormEmpleados(); DataTable DTVendedores = null; DataRow DRVendedor = null; string codigo = ""; try { isChangeVendodorId = false; codigo = txtVendedorId.Text.Replace("-", ""); if (tipo == 0) { objDB.LimpiarFiltros(); objDB.AddFiltroIgualA("EsActivo", "1"); objDB.AddFiltroIgualA("EsVendedor", "1"); objDB.AddFiltroPersonalizado("( Cast(Empleado_Id as Varchar) = '" + codigo + "' Or Replace(CedulaRNC, '-', '') = '" + codigo + "')"); DTVendedores = objDB.GetAll("VVENDEDORES", 1, objDB.Filtros); if (DTVendedores.Rows.Count > 0) { DRVendedor = DTVendedores.Rows[0]; } } if (tipo == 1 || (tipo == 0 && codigo != "" && DRVendedor == null)) { //Realizamos una Busqueda General frm.Text = "VENDEDORES"; frm.empresaID = EMPRESA_ID; frm.oficinaID = OFICINA_ID; frm.esBusqueda = true; frm.EnEjecusion = true; frm.EsAgregar = false; frm.EsModificar = false; frm.textoABuscar = codigo; frm.FiltroEstatico = "EsActivo = 1 And EsVendedor = 1"; frm.ShowDialog(); if (frm.filaSelecionada != null) { DRVendedor = frm.filaSelecionada; } } if (DRVendedor != null) { txtVendedorId.Text = DRVendedor["Empleado_Id"].ToString(); txtVendedorNombre.Text = DRVendedor["Nombre_Completo"].ToString(); txtCodigo.Focus(); txtCodigo.Focus(); } else { txtVendedorId.Text = "0"; txtVendedorNombre.Text = ""; } } catch (Exception ex) { objUtil.MostrarMensajeError("Error al Buscar Vendedor, " + ex.Message); } finally { frm.Dispose(); DTVendedores = null; DRVendedor = null; } }
void GetEmpleado(String codigo = "", bool esSupervisor = false) { DataTable DTData = null; DataRow fila0 = null; int empleadoId = 0; string nombre = "(NO ASIGNADO)"; ELRMaestros.FormEmpleados frm = new ELRMaestros.FormEmpleados(); String SSQL = ""; try { codigo = codigo.Trim().Replace('-', ' '); if (codigo != "") { SSQL = "SELECT TOP 1 Empleado_Id, Nombres, Apellidos FROM TRRHH_EMPLEADOS"; SSQL += " WHERE ( Cast(Empleado_Id as Varchar) = '" + codigo + "' "; SSQL += " Or REPLACE(CedulaRNC, '-', '') = '" + codigo + "') "; SSQL += " And EsActivo = 1 And Fecha_Baja Is Null "; DTData = objDB.GetSQL(SSQL); if (DTData.Rows.Count > 0) { fila0 = DTData.Rows[0]; } } else { frm.nombreUsuario = nombreUsuario; frm.empresaID = EMPRESA_ID; frm.oficinaID = OFICINA_ID; frm.esBusqueda = true; frm.EsAgregar = false; frm.EsModificar = false; frm.EnEjecusion = true; frm.FiltroEstatico = "EsActivo = 1 And EsVendedor = 1"; frm.Text = esSupervisor ? "ELEGIR SUPERVISOR DE CREDITO" : "ELEGIR OFICIAL DE CREDITO"; frm.ShowDialog(); if (frm.filaSelecionada != null) { fila0 = frm.filaSelecionada; } } //COLOCAMOS DATOS DEL OFICIAL DE CREDITO if (fila0 != null) { empleadoId = objUtil.GetAsInt("Empleado_Id", fila0); nombre = objUtil.GetAsString("Nombres", fila0, ""); nombre += " " + objUtil.GetAsString("Apellidos", fila0, ""); } if (!esSupervisor) { txtOficial.Text = empleadoId.ToString(); lblOficialNombre.Text = nombre; SetValorEncabezado("Oficial_Id", empleadoId); SetValorEncabezado("Evaluador_Id", empleadoId); SetValorEncabezado("Oficial_Nombre", nombre); } } catch (Exception ex) { objUtil.MostrarMensajeError(ex.Message); } finally { frm.Dispose(); fila0 = null; DTData = null; } }