protected void btnBuscar_Click(object sender, EventArgs e) { try { lstEMTmp = (List <EEMPLEADO>)ViewState["EmpleadosTmp"]; BFEMPLEADO objBFEM = new BFEMPLEADO(); lstEMTmp = objBFEM.GetEmpleadosPorFiltros(Utiles.ConvertToString(this.txtNombreColaborador.Text), Utiles.ConvertToInt64(this.ddlEmpresa.SelectedValue), this.ddlGerencia.SelectedValue, this.ddlCentroCosto.SelectedValue, this.ddlSucursal.SelectedValue, this.ddlArea.SelectedValue, this.ddlCargo.SelectedValue, this.ddlRol.SelectedValue, this.ddlClasificador1.SelectedValue, this.ddlClasificador2.SelectedValue); ViewState["EmpleadosTmp"] = lstEMTmp; objWEB.LlenaGrilla(ref this.grdColaboradoresTmp, lstEMTmp.Cast <DomainObject>().ToList(), 20); ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('1');", true); } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }
protected void btnCargarUsuarios_Click(object sender, EventArgs e) { try { DataTable _dtErroresCarga; _dtErroresCarga = new DataTable(); _dtErroresCarga.Columns.Add("Rut"); _dtErroresCarga.Columns.Add("Error"); objWEB.LlenaGrilladt(ref this.grdDetalleErrores, _dtErroresCarga, 100); //ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('2');", true); string strArchivo = fulUsuarios.FileName; string strExtension = strArchivo.Substring(strArchivo.LastIndexOf(".") + 1); if (!(strExtension.ToUpper() == "XLS")) { ScriptManager.RegisterStartupScript(this, this.GetType(), "SessionUsuario", "alert('ATENCION: Debe seleccionar un archivo (XLS).');", true); return; } string strRuta = ""; strRuta = System.AppDomain.CurrentDomain.BaseDirectory + "tmp\\carga_usuarios_" + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + "_" + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + ".xls"; if (System.IO.File.Exists(strRuta)) { System.IO.File.Delete(strRuta); } this.fulUsuarios.SaveAs(strRuta); BFEMPLEADO objBFSE = new BFEMPLEADO(); DataTable dt = objBFSE.GetEmpleadosExcel(strRuta, objSession.RutEmpresa); objWEB.LlenaGrilladt(ref this.grdResultados, dt, 100); objWEB.LlenaGrilladt(ref this.grdDetalleErrores, objBFSE.DtErroresCarga, 100); if (grdDetalleErrores.Rows.Count > 0) { divErrores.Visible = true; } else { divErrores.Visible = false; } ViewState["ListaSecciones"] = lstSeccion; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('4');", true); } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }
protected void btnConsular_Click(object sender, EventArgs e) { try { BFEMPLEADO objBFEM = new BFEMPLEADO(); objWEB.LlenaGrilla(ref this.grdResultados, objBFEM.GetEMPLEADOAll().Cast <DomainObject>().ToList(), 20); } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }
protected void Guardar() { try { BFINSTRUMENTO objBFIN = new BFINSTRUMENTO(); EINSTRUMENTO objIN = objBFIN.GetINSTRUMENTOEMPRESA(Utiles.ConvertToInt64(this.ddlInstrumentos.SelectedValue), objSession.RutEmpresa); List <EEMPLEADO> lst = new List <EEMPLEADO>(); //= (List<EEMPLEADO>)ViewState["Empleados"]; BFEMPLEADO objBFEM = new BFEMPLEADO(); EEMPLEADO objEM; foreach (GridViewRow grdRow in this.grdColaboradores.Rows) { if (((CheckBox)grdRow.FindControl("chkSeleccionar")).Checked) { objEM = objBFEM.GetEMPLEADO(Utiles.RutUsrALng(((Label)grdRow.FindControl("lblRut")).Text)); objEM.RUTJEFE = Utiles.RutUsrALng(((HiddenField)grdRow.FindControl("hdfRutEvaluador")).Value); lst.Add(objEM); } } BFINSTRUMENTOEMPLEADO objBFIE = new BFINSTRUMENTOEMPLEADO(); objBFIE.AsignarPorTipo(objIN, lst, this.txtNombre.Text, Utiles.ConvertToDateTime(this.txtInicio.Text), Utiles.ConvertToDateTime(this.txtFin.Text), objSession.RutEmpresa, Utiles.ConvertToInt16(ddlTipoEvaluacion.SelectedValue)); List <EINSTRUMENTOEMPLEADO> lstAsg = objBFIE.GetAsignaciones(ddlInstrumentos.SelectedValue, this.txtNombre.Text, Utiles.ConvertToDateTime(txtInicio.Text), Utiles.ConvertToDateTime(txtFin.Text), Utiles.ConvertToInt16(ddlTipoEvaluacion.SelectedValue)); objWEB.LlenaGrilla(ref this.grdAsignaciones, lstAsg.Cast <DomainObject>().ToList(), 1000); ViewState["Modo"] = "Actualizar"; if (this.grdAsignaciones.Rows.Count > 0) { divActualizacion.Visible = true; } CargaJefes(); CargaAsignacionesEvaluador(); ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('4');", true); } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }
protected void btnAgregar_Click(object sender, EventArgs e) { try { List <EEMPLEADO> lst = (List <EEMPLEADO>)ViewState["Empleados"]; Boolean blnExiste; foreach (GridViewRow grd in this.grdColaboradoresTmp.Rows) { if (((CheckBox)grd.FindControl("chkSeleccionar")).Checked) { blnExiste = false; foreach (EEMPLEADO obj in lst) { if (obj.RUTCOMPLETO == ((Label)grd.FindControl("lblRut")).Text) { blnExiste = true; } } if (blnExiste == false) { BFEMPLEADO objBFEM = new BFEMPLEADO(); lst.Add(objBFEM.GetEMPLEADO(Utiles.RutUsrALng(((Label)grd.FindControl("lblRut")).Text))); } } } ViewState["Empleados"] = lst; objWEB.LlenaGrilla(ref this.grdColaboradores, lst.Cast <DomainObject>().ToList(), 25); if (this.grdColaboradores.Rows.Count > 0) { btnEliminarColaborador.Visible = true; } else { btnEliminarColaborador.Visible = false; } } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }
protected void InicializarFormulario() { try { BFINSTRUMENTOEMPLEADO objIN = new BFINSTRUMENTOEMPLEADO(); objWEB.LlenaDDL(ref ddlEvaluaciones, objIN.Asignaciones(), "NOM_INSTRUMENTO_EMPLEADO", "NOM_INSTRUMENTO_EMPLEADO"); BFEMPRESA objBFEMP = new BFEMPRESA(); objWEB.LlenaDDL(ref this.ddlEmpresa, objBFEMP.GetEMPRESAAll().Cast <DomainObject>().ToList(), "RUTEMPRESA", "NOMBREFANTASIA"); objWEB.AgregaValorDDL(ref this.ddlEmpresa, "Sin InformaciĆ³n", "0"); this.ddlEmpresa.SelectedValue = "0"; if (ddlEmpresa.Items.Count > 1) { this.divEmpresa.Visible = true; } if (objSession.EsSuperAdministrador) { this.divEmpresa.Visible = true; } else { this.divEmpresa.Visible = false; } BFGERENCIA objBFEGE = new BFGERENCIA(); objWEB.LlenaDDL(ref this.ddlGerencia, objBFEGE.GetGERENCIAAll(objSession.RutEmpresa).Cast <DomainObject>().ToList(), "CODGERENCIA", "NOMBREGERENCIA"); this.ddlGerencia.SelectedValue = "-"; if (ddlGerencia.Items.Count > 1) { this.divGerencia.Visible = true; } BFCENTROCOSTO objBFCC = new BFCENTROCOSTO(); objWEB.LlenaDDL(ref this.ddlCentroCosto, objBFCC.GetCENTROCOSTOAll(objSession.RutEmpresa).Cast <DomainObject>().ToList(), "CODCENTROCOSTO", "NOMBRECENTROCOSTO"); this.ddlCentroCosto.SelectedValue = "-"; if (ddlCentroCosto.Items.Count > 1) { this.divCentroCosto.Visible = true; } BFSUCURSAL objBFSU = new BFSUCURSAL(); objWEB.LlenaDDL(ref this.ddlSucursal, objBFSU.GetSUCURSALAll(objSession.RutEmpresa).Cast <DomainObject>().ToList(), "CODSUCURSAL", "NOMBRESUCURSAL"); this.ddlSucursal.SelectedValue = "-"; if (ddlSucursal.Items.Count > 1) { this.divSucursal.Visible = true; } BFAREA objBFAR = new BFAREA(); objWEB.LlenaDDL(ref this.ddlArea, objBFAR.GetAREAAll(objSession.RutEmpresa).Cast <DomainObject>().ToList(), "CODAREA", "NOMBREAREA"); this.ddlArea.SelectedValue = "-"; if (ddlArea.Items.Count > 1) { this.divArea.Visible = true; } BFCARGO objBFCA = new BFCARGO(); objWEB.LlenaDDL(ref this.ddlCargo, objBFCA.GetCARGOAll(objSession.RutEmpresa).Cast <DomainObject>().ToList(), "CODCARGO", "NOMBRECARGO"); this.ddlCargo.SelectedValue = "-"; if (ddlCargo.Items.Count > 1) { this.divCargo.Visible = true; } BFROL objBFRO = new BFROL(); objWEB.LlenaDDL(ref this.ddlRol, objBFRO.GetROLAll(objSession.RutEmpresa).Cast <DomainObject>().ToList(), "CODROL", "NOMBREROL"); this.ddlRol.SelectedValue = "-"; if (ddlRol.Items.Count > 1) { this.divRol.Visible = true; } BFCLASIFICADOR1 objBFCL1 = new BFCLASIFICADOR1(); objWEB.LlenaDDL(ref this.ddlClasificador1, objBFCL1.GetCLASIFICADOR1All(objSession.RutEmpresa).Cast <DomainObject>().ToList(), "CODCLASIFICADOR1", "NOMBRECLASIFICADOR1"); this.ddlClasificador1.SelectedValue = ""; if (ddlClasificador1.Items.Count > 1) { this.divClasificador1.Visible = true; } BFCLASIFICADOR2 objBFCL2 = new BFCLASIFICADOR2(); objWEB.LlenaDDL(ref this.ddlClasificador2, objBFCL2.GetCLASIFICADOR2All(objSession.RutEmpresa).Cast <DomainObject>().ToList(), "CODCLASIFICADOR2", "NOMBRECLASIFICADOR2"); this.ddlClasificador2.SelectedValue = ""; if (ddlClasificador2.Items.Count > 1) { this.divClasificador2.Visible = true; } BFEMPLEADO objBFEM = new BFEMPLEADO(); objWEB.LlenaDDL(ref this.ddlEvaluador, objBFEM.GetEvaluadoresPorEvaluacion(this.ddlEvaluaciones.SelectedValue), "RUT_EMPLEADO", "NOMBRE"); objWEB.AgregaValorDDL(ref this.ddlEvaluador, "Todos", "0"); this.ddlEvaluador.SelectedValue = "0"; if (ddlEvaluador.Items.Count > 1) { this.divEvaluador.Visible = true; } objWEB.LlenaDDL(ref this.ddlVisador, objBFEM.GetVisadoresPorEvaluacion(this.ddlEvaluaciones.SelectedValue), "RUT_EMPLEADO", "NOMBRE"); objWEB.AgregaValorDDL(ref this.ddlVisador, "Todos", "0"); this.ddlVisador.SelectedValue = "0"; if (ddlVisador.Items.Count > 1) { this.ddlVisador.Visible = true; } Consultar(); VerDetalles(1); } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }
protected void btnContinuarGuardar_Click(object sender, EventArgs e) { try { if (!ValidarFormulario()) { ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('1');", true); return; } else { if (chkEsEmpleado.Checked) { BFEMPLEADO objBFEM = new BFEMPLEADO(); EEMPLEADO objEM = new EEMPLEADO(); objEM.RUTEMPLEADO = Utiles.RutUsrALng(this.txtRut.Text); objEM.NOMBREEMPLEADO = this.txtNombre.Text; objEM.APELLIDOPATERNO = this.txtApPaterno.Text; objEM.APELLIDOMATERNO = this.txtApMaterno.Text; objEM.EMAIL = this.txtEmail.Text; objEM.FECHAINGRESO = Utiles.ConvertToDateTime(this.txtFechaContrato.Text); objEM.RUTEMPRESA = Utiles.ConvertToInt64(this.ddlEmpresa.SelectedValue); objEM.CODSUCURSAL = this.ddlSucursal.SelectedValue; objEM.CODAREA = this.ddlArea.SelectedValue; objEM.CODCARGO = this.ddlCargo.SelectedValue; objEM.CODROL = this.ddlRol.SelectedValue; objEM.COD_GERENCIA = this.ddlGerencia.SelectedValue; objEM.COD_CENTRO_COSTO = this.ddlCentroCosto.SelectedValue; objEM.COD_CLASIFICADOR_1 = this.ddlClasif1.SelectedValue; objEM.COD_CLASIFICADOR_2 = this.ddlClasif2.SelectedValue; objEM.RUTJEFE = Utiles.RutUsrALng(this.txtRutJefe.Text); //objEM.RUTVISADOR = this.txt objEM.FECHA_NACIMIENTO = Utiles.ConvertToDateTime(this.txtFechaNacimiento.Text); objEM.COD_SEXO = this.ddlSexo.SelectedValue; objEM.COD_NIVEL_EDUCACIONAL = Utiles.ConvertToInt16(this.ddlNivEscolaridad.SelectedValue); objEM.COD_NIVEL_OCUPACIONAL = Utiles.ConvertToInt16(this.ddlNivOcupacional.SelectedValue); objEM.COD_UNIDAD = this.ddlUnidad.SelectedValue; objEM.COD_DIRECCION = this.ddlDireccion.SelectedValue; objEM.COD_COMUNA = this.ddlComuna.SelectedValue; objEM.FLAG_ACTIVO = this.chkActivo.Checked; if (ViewState["Modo"].ToString() == "Insertar") { objEM.IsPersisted = false; } else { objEM.IsPersisted = true; } objBFEM.Save(objEM); } BFUSUARIO objBFUS = new BFUSUARIO(); EUSUARIO objUS = new EUSUARIO(); objUS.RUTUSUARIO = Utiles.RutUsrALng(this.txtRut.Text); objUS.NOMBREUSUARIO = this.txtNombre.Text; objUS.APELLIDOPATERNO = this.txtApPaterno.Text; objUS.APELLIDOMATERNO = this.txtApMaterno.Text; objUS.EMAIL = this.txtEmail.Text; objUS.PASSWORD = CCryptografia.Encriptar(this.txtPassword.Text); objUS.FLAGACTIVO = this.chkActivo.Checked; if (ViewState["Modo"].ToString() == "Insertar") { objUS.IsPersisted = false; } else { objUS.IsPersisted = true; } objBFUS.Save(objUS); BFPERFILUSUARIO objBFPU = new BFPERFILUSUARIO(); EPERFILUSUARIO objPU = new EPERFILUSUARIO(); objPU.CODPERFIL = 1; objPU.RUTUSUARIO = Utiles.RutUsrALng(this.txtRut.Text); objBFPU.Delete(objPU); objPU = new EPERFILUSUARIO(); objPU.CODPERFIL = 2; objPU.RUTUSUARIO = Utiles.RutUsrALng(this.txtRut.Text); objBFPU.Delete(objPU); foreach (ListItem item in this.lstAsignados.Items) { objPU = new EPERFILUSUARIO(); objPU.CODPERFIL = Utiles.ConvertToInt16(item.Value); objPU.RUTUSUARIO = Utiles.RutUsrALng(this.txtRut.Text); objBFPU.Save(objPU); } //objWEB.LlenaGrilla(ref grdResultados, objBFUS.GetUsuarios(Utiles.RutUsrALng(this.txtRutUsuario.Text), Utiles.ConvertToString(this.txtNombreUsuario.Text)).Cast<DomainObject>().ToList(), 20); objWEB.LlenaGrilladt(ref grdResultados, objBFUS.GetUsuariosDT(Utiles.RutUsrALng(this.txtRutUsuario.Text), Utiles.ConvertToString(this.txtNombreUsuario.Text)), 20); ScriptManager.RegisterStartupScript(this, this.GetType(), "SessionUsuario", "alert('ATENCION: Los datos han sido almacenados exitosamente.');", true); } } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }
protected void Cargar() { try { BFINSTRUMENTOEMPLEADO objBFIE = new BFINSTRUMENTOEMPLEADO(); EINSTRUMENTOEMPLEADO objIE = objBFIE.GetINSTRUMENTOEMPLEADO(Utiles.ConvertToInt64(ViewState["CodInstrumentoEmpleado"])); ViewState["Instrumento"] = objIE; BFEMPLEADO objBFEM = new BFEMPLEADO(); EEMPLEADO objEM = objBFEM.GetEMPLEADO(objIE.RUTEMPLEADO); this.txtRut.Text = objEM.RUTCOMPLETO; this.txtNombreUsuario.Text = objEM.NOMBRECOMPLETO; BFGERENCIA objBFGE = new BFGERENCIA(); this.txtGerencia.Text = objEM.NOMBRE_GERENCIA; this.txtCargo.Text = objEM.NOMBRE_CARGO; this.txtResultado.Text = Utiles.ConvertToString(objIE.RESULTADO); lblNombreFormulario.Text = objIE.NOMINSTRUMENTOEMPLEADO; if (objIE.RESULTADO > 0) { lblNombreFormulario.Text = lblNombreFormulario.Text + " - " + Utiles.ConvertToString(objIE.RESULTADO); } lblDescripcion.Text = objIE.DESCRIPCION; lblObservacion.Text = objIE.OBSERVACION; objWEB.LlenaGrilla(ref this.grdSecciones, objIE.SECCIONES.Cast <DomainObject>().ToList(), 100); BFINSTRUMENTO objBFIN = new BFINSTRUMENTO(); EINSTRUMENTO objIN = objBFIN.GetINSTRUMENTO(Utiles.ConvertToInt64(objIE.CODINSTRUMENTO)); BFESCALA objBFES = new BFESCALA(); EESCALA objES = objBFES.GetESCALA(Utiles.ConvertToInt64(objIN.CODESCALA)); switch (Utiles.ConvertToString(objIE.CODESTADOEVAL)) { case "1": btnVolver.Visible = true; btnGuardar.Visible = true; break; case "2": btnVolver.Visible = true; btnGuardar.Visible = false; break; case "3": btnVolver.Visible = true; btnGuardar.Visible = false; break; case "4": btnVolver.Visible = true; btnGuardar.Visible = false; break; case "5": btnVolver.Visible = true; btnGuardar.Visible = false; break; case "6": btnVolver.Visible = true; btnGuardar.Visible = false; break; } } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }