private void configurarBotonesDeAccion(Boolean bNuevo, Boolean bModificar, Boolean bGuardar, Boolean bCancelar, Boolean bVolver) { Button_NUEVO.Visible = bNuevo; Button_NUEVO.Enabled = bNuevo; Button_NUEVO_1.Visible = bNuevo; Button_NUEVO_1.Enabled = bNuevo; Boolean puedeModificar = true; if (bModificar == true) { seguridad _s = new seguridad(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaRestriccion = _s.UsuarioConRestriccionTopoReq(Session["USU_LOG"].ToString()); if (tablaRestriccion.Rows.Count > 0) { DataRow fila = tablaRestriccion.Rows[0]; if (fila["RESTRICCION"].ToString().Trim().ToUpper() == "TRUE") { if (DropDownList_TIP_REQ.SelectedValue != "USUARIO") { puedeModificar = false; } } } Button_MODIFICAR.Visible = puedeModificar; Button_MODIFICAR.Enabled = puedeModificar; Button_MODIFICAR_1.Visible = puedeModificar; Button_MODIFICAR_1.Enabled = puedeModificar; } else { Button_MODIFICAR.Visible = bModificar; Button_MODIFICAR.Enabled = bModificar; Button_MODIFICAR_1.Visible = bModificar; Button_MODIFICAR_1.Enabled = bModificar; } Button_GUARDAR.Visible = bGuardar; Button_GUARDAR.Enabled = bGuardar; Button_GUARDAR_1.Visible = bGuardar; Button_GUARDAR_1.Enabled = bGuardar; Button_CANCELAR.Visible = bCancelar; Button_CANCELAR.Enabled = bCancelar; Button_CANCELAR_1.Visible = bCancelar; Button_CANCELAR_1.Enabled = bCancelar; Button_VOLVER.Visible = bVolver; Button_VOLVER.Enabled = bVolver; Button_VOLVER_1.Visible = bVolver; Button_VOLVER_1.Enabled = bVolver; }
private void CargarDatosEstadoRequisicion(Boolean modificar, DataRow filaRequisicion) { DateTime fechaVencimiento; DateTime fechaHoy = Convert.ToDateTime(DateTime.Now.ToShortDateString()); Int32 diasAviso = obtenerParametroAvisoDiasVencimientoContrato(); if (modificar == false) { configurarPaneles(false, false, false, false, false, true); if ((filaRequisicion["CUMPLIDO"].ToString() == "N") && (filaRequisicion["CANCELADO"].ToString() == "N")) { if (HiddenField_ID_SERVICIO_RESPECTIVO.Value == "") { fechaVencimiento = new DateTime(); } else { fechaVencimiento = Convert.ToDateTime(GridView_CONTRATOS_ACTIVOS.SelectedRow.Cells[3].Text); } if (fechaVencimiento < fechaHoy) { configurarMensajes(true, System.Drawing.Color.Red); Label_MENSAJE.Text = "El Servicio Respectivo asociado a la requisición está vencido ó no se pudo determinar."; Panel_BOTONES_ACCIONES_REQUISICION.Visible = false; } else { if (fechaVencimiento.AddDays(-diasAviso) <= fechaHoy) { configurarMensajes(true, System.Drawing.Color.Orange); Label_MENSAJE.Text = "El Servicio Respectivo asociado a la requisición está por vencer."; Panel_BOTONES_ACCIONES_REQUISICION.Visible = true; } else { Panel_BOTONES_ACCIONES_REQUISICION.Visible = true; } } seguridad _s = new seguridad(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaRestriccion = _s.UsuarioConRestriccionTopoReq(Session["USU_LOG"].ToString()); if (tablaRestriccion.Rows.Count <= 0) { Button_COPIAR_REQ.Visible = true; } else { DataRow fila = tablaRestriccion.Rows[0]; if (fila["RESTRICCION"].ToString().Trim().ToUpper() == "TRUE") { if (DropDownList_TIP_REQ.SelectedValue != "USUARIO") { Button_COPIAR_REQ.Visible = false; } else { Button_COPIAR_REQ.Visible = true; } } else { Button_COPIAR_REQ.Visible = true; } } } else { Panel_BOTONES_ACCIONES_REQUISICION.Visible = false; if (filaRequisicion["CUMPLIDO"].ToString().ToUpper() == "S") { configurarMensajes(true, System.Drawing.Color.Orange); Label_MENSAJE.Text = "La requisición NO puede ser editada porque su estado es CUMPLIDA por: " + filaRequisicion["MOTIVO_CUMPLIDO"].ToString().Trim() + "."; } else { if (filaRequisicion["CANCELADO"].ToString().ToUpper() == "S") { configurarMensajes(true, System.Drawing.Color.Orange); Label_MENSAJE.Text = "La requisición NO puede ser editada porque su estado es CANCELADA por: " + filaRequisicion["MOTIVO_CANCELA"].ToString().Trim() + "."; } else { configurarMensajes(true, System.Drawing.Color.Red); Label_MENSAJE.Text = "La requisición NO puede ser editada porque su estado es DESCONOCIDO."; } } } } else { configurarPaneles(false, false, false, false, false, true); Panel_BOTONES_ACCIONES_REQUISICION.Visible = false; } if (modificar == true) { configurarBotonesDeAccion(false, false, true, true, true); Panel_BOTONES_ACCION_1.Visible = true; } else { Panel_BOTONES_ACCION_1.Visible = false; if ((filaRequisicion["CUMPLIDO"].ToString().ToUpper() == "N") && (filaRequisicion["CANCELADO"].ToString().ToUpper() == "N")) { if (HiddenField_ID_SERVICIO_RESPECTIVO.Value == "") { fechaVencimiento = new DateTime(); } else { fechaVencimiento = Convert.ToDateTime(GridView_CONTRATOS_ACTIVOS.SelectedRow.Cells[3].Text); } if (fechaVencimiento < fechaHoy) { configurarBotonesDeAccion(true, true, false, false, true); } else { if (fechaVencimiento.AddDays(-diasAviso) <= fechaHoy) { configurarBotonesDeAccion(true, true, false, false, true); } else { configurarBotonesDeAccion(true, true, false, false, true); } } } else { configurarBotonesDeAccion(true, false, false, false, true); } } Button_ENVIAR_CANDIDATOS.Visible = true; }