protected void btnSave_click(object sender, EventArgs e) { E_REQUISICION VRequisicionAgregar = new E_REQUISICION(); RequisicionNegocio nrequisicion = new RequisicionNegocio(); ptipo = E_TIPO_OPERACION_DB.I.ToString(); VRequisicionAgregar.NO_REQUISICION = txtNo_requisicion.Text; VRequisicionAgregar.FE_SOLICITUD = Fe_solicitud.SelectedDate; VRequisicionAgregar.FE_REQUERIMIENTO = Fe_Requerimiento.SelectedDate; VRequisicionAgregar.ID_PUESTO = int.Parse(cmbPuestos.SelectedValue); VRequisicionAgregar.CL_ESTADO = "VIGENTE"; VRequisicionAgregar.CL_CAUSA = cmbCausas.SelectedValue; VRequisicionAgregar.DS_CAUSA = txtEspecifique.Text; DepartamentoNegocio ndepartamento = new DepartamentoNegocio(); var vdepartamento = ndepartamento.Obtener_M_DEPARTAMENTO(NB_DEPARTAMENTO: txtArea.Text).FirstOrDefault(); /*Se encarga de dar el ID_AUTORIZA y el ID_SOLICITANTE*/ EmpleadoNegocio nempleado = new EmpleadoNegocio(); var vEmpleado = nempleado.Obtener_M_EMPLEADO(int.Parse(cmbAutoriza.SelectedValue)).FirstOrDefault(); VRequisicionAgregar.ID_AUTORIZA = vEmpleado.ID_EMPLEADO; VRequisicionAgregar.ID_EMPRESA = vEmpleado.ID_EMPRESA; // VRequisicionAgregar.ID_VISTO_BUENO = vEmpleado.ID_EMPLEADO; UsuarioNegocio nUsuario = new UsuarioNegocio(); var vusuarioSolicita = nUsuario.Obtener_C_USUARIO(CL_USUARIO: vClUsuario.ToString()).FirstOrDefault(); if (vusuarioSolicita != null) { VRequisicionAgregar.ID_SOLICITANTE = vusuarioSolicita.ID_EMPLEADO; } if (Request.Params["ID"] != null) { pID_REQUISICION = int.Parse(Request.Params["ID"]); ptipo = E_TIPO_OPERACION_DB.A.ToString(); VRequisicionAgregar.ID_REQUISICION = pID_REQUISICION; } else { VRequisicionAgregar.ID_REQUISICION = 0; VRequisicionAgregar.CL_ESTADO = "VIGENTE"; } if (VRequisicionAgregar != null) { E_RESULTADO vResultado = nrequisicion.InsertaActualiza_K_REQUISICION(tipo_transaccion: ptipo, programa: vNbPrograma, usuario: vClUsuario, V_K_REQUISICION: VRequisicionAgregar); string vMensaje = vResultado.MENSAJE.Where(w => w.CL_IDIOMA.Equals(vClIdioma.ToString())).FirstOrDefault().DS_MENSAJE; UtilMensajes.MensajeResultadoDB(rnMensaje, vMensaje, vResultado.CL_TIPO_ERROR); } }
protected void Page_Load(object sender, EventArgs e) { DepartamentoNegocio negocio = new DepartamentoNegocio(); RequisicionNegocio nRequisicion = new RequisicionNegocio(); if (!IsPostBack) { CatalogoListaNegocio nlista = new CatalogoListaNegocio(); var vCatalogoVacantes = nlista.Obtener_C_CATALOGO_LISTA(ID_CATALOGO_LISTA: ContextoApp.IdCatalogoCausaVacantes).FirstOrDefault(); if (vCatalogoVacantes != null) { CatalogoValorNegocio nvalor = new CatalogoValorNegocio(); var vCausas = nvalor.Obtener_C_CATALOGO_VALOR(ID_CATALOGO_LISTA: vCatalogoVacantes.ID_CATALOGO_LISTA); if (vCausas != null) { cmbCausas.DataSource = vCausas; cmbCausas.DataTextField = "NB_CATALOGO_VALOR"; cmbCausas.DataValueField = "CL_CATALOGO_VALOR"; cmbCausas.DataBind(); } } EmpleadoNegocio nEmpleado = new EmpleadoNegocio(); var vEmpleados = nEmpleado.Obtener_M_EMPLEADO(); if (vEmpleados != null) { cmbAutoriza.DataSource = vEmpleados; cmbAutoriza.DataTextField = "NB_EMPLEADO_COMPLETO"; cmbAutoriza.DataValueField = "ID_EMPLEADO"; cmbAutoriza.DataBind(); txtSolicitado.Text = vClUsuario.ToString(); txtSolicitado.ReadOnly = true; } PuestoNegocio nPuestos = new PuestoNegocio(); var Vpuestos = nPuestos.Obtener_M_PUESTO(); if (Vpuestos != null) { cmbPuestos.DataSource = Vpuestos;//LLENAMOS DE DATOS EL GRID cmbPuestos.DataTextField = "CL_PUESTO"; cmbPuestos.DataTextField = "NB_PUESTO"; cmbPuestos.DataValueField = "ID_PUESTO"; cmbPuestos.DataBind(); } if (Request.Params["ID"] != null) { pID_REQUISICION = int.Parse(Request.Params["ID"]); var vRequisicion = nRequisicion.Obtener_K_REQUISICION(ID_REQUISICION: pID_REQUISICION).FirstOrDefault(); txtNo_requisicion.Text = vRequisicion.NO_REQUISICION; Fe_solicitud.SelectedDate = vRequisicion.FE_SOLICITUD; Fe_Requerimiento.SelectedDate = vRequisicion.FE_REQUERIMIENTO; cmbPuestos.SelectedValue = vRequisicion.ID_PUESTO + ""; // VRequisicionAgregar.CL_ESTADO = "VIGENTE"; cmbCausas.SelectedValue = vRequisicion.CL_CAUSA; txtEspecifique.Text = vRequisicion.DS_CAUSA; PuestoNegocio npuesto = new PuestoNegocio(); var vpuesto = npuesto.Obtener_M_PUESTO(ID_PUESTO: vRequisicion.ID_PUESTO).FirstOrDefault(); txtArea.Text = vpuesto.NB_DEPARTAMENTO; cmbPuestos.SelectedValue = vpuesto.ID_PUESTO.ToString(); txtClPuesto.Text = vpuesto.CL_PUESTO.ToString(); SPE_OBTIENE_SUELDO_PROMEDIO_PUESTO_Result Vsueldo = nRequisicion.Obtener_Sueldo_Promedio_Puesto(ID_PUESTO: int.Parse(cmbPuestos.SelectedValue)); txtSueldo.Text = Vsueldo.MN_SUELDO_PROMEDIO + ""; Fe_Requerimiento.SelectedDate = vRequisicion.FE_REQUERIMIENTO; Fe_solicitud.SelectedDate = vRequisicion.FE_SOLICITUD; cmbAutoriza.SelectedValue = vRequisicion.ID_AUTORIZA.ToString(); txtVistoBueno.Text = ""; } } }