Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            vClUsuario  = ContextoUsuario.oUsuario.CL_USUARIO;
            vNbPrograma = ContextoUsuario.nbPrograma;

            if (!Page.IsPostBack)
            {
                vLstPuestos = new List <E_PUESTOS_CONSULTA>();

                if (Request.Params["ConsultaGlobalId"].ToString() != null)
                {
                    vIdConsultaGlobal = Guid.Parse(Request.Params["ConsultaGlobalId"].ToString());
                }


                if (ContextoConsultaGlobal.oPuestosConfiguracion != null)
                {
                    E_PUESTOS_CONSULTA_GLOBAL vLstContextoConsulta = ContextoConsultaGlobal.oPuestosConfiguracion.Where(w => w.vIdParametroConfiguracionConsulta == vIdConsultaGlobal).FirstOrDefault();
                    vLstPuestos = vLstContextoConsulta.vListaPuestos;


                    if (vLstPuestos.Count > 1)
                    {
                        txtPuesto.Visible = false;
                        lbPuesto.Visible  = false;
                        tabla.Visible     = false;

                        vIdPuesto = vLstPuestos.FirstOrDefault().ID_PUESTO;
                        CargarDatos();
                    }
                    else
                    {
                        foreach (E_PUESTOS_CONSULTA item in vLstPuestos)
                        {
                            vIdPuesto = item.ID_PUESTO;
                        }
                        rtsConsultaGlobal.Tabs[0].Visible       = false;
                        rtsConsultaGlobal.Tabs[1].Visible       = false;
                        rmpConsultaGlobal.PageViews[0].Visible  = false;
                        rmpConsultaGlobal.PageViews[1].Selected = true;

                        CargarDatos();
                    }
                }


                //if (Request.Params["PuestoId"] != null)
                //{
                //    vIdPuesto = int.Parse(Request.Params["PuestoId"].ToString());
                //CargarDatos();
                // }
            }
        }
        protected void btnFactores_Click(object sender, EventArgs e)
        {
            ContextoConsultaGlobal.oPuestosConfiguracion.Where(w => w.vIdParametroConfiguracionConsulta == vIdConsultaGlobal).FirstOrDefault().vListaPuestos.Clear();

            if (grdDescriptivo.SelectedItems.Count > 0)
            {
                foreach (GridDataItem item in grdDescriptivo.SelectedItems)
                {
                    int    vIdPuesto = int.Parse(item.GetDataKeyValue("ID_PUESTO").ToString());
                    string vClPuesto = item.GetDataKeyValue("CL_PUESTO").ToString();
                    string vNbPuesto = item.GetDataKeyValue("NB_PUESTO").ToString();

                    //if (vLstPuestos.Where(w => w.ID_PUESTO == vIdPuesto).Count() == 0)
                    //{
                    //    vLstPuestos.Add(new E_PUESTOS_CONSULTA { ID_PUESTO = vIdPuesto });
                    ContextoConsultaGlobal.oPuestosConfiguracion.Where(w => w.vIdParametroConfiguracionConsulta == vIdConsultaGlobal).FirstOrDefault().vListaPuestos.Add(new E_PUESTOS_CONSULTA {
                        ID_PUESTO = vIdPuesto, CL_PUESTO = vClPuesto, NB_PUESTO = vNbPuesto
                    });
                    //  }
                }

                E_PUESTOS_CONSULTA_GLOBAL vLstContextoConsulta = ContextoConsultaGlobal.oPuestosConfiguracion.Where(w => w.vIdParametroConfiguracionConsulta == vIdConsultaGlobal).FirstOrDefault();
                vLstPuestos = vLstContextoConsulta.vListaPuestos;
                int vIdPuestoComparar = vLstPuestos.FirstOrDefault().ID_PUESTO;

                var vXelements = vLstPuestos.Select(x =>
                                                    new XElement("PUESTOS",
                                                                 new XAttribute("ID_PUESTO", x.ID_PUESTO)
                                                                 ));

                SELECCIONPUESTOS = new XElement("SELECCION", vXelements
                                                );

                PuestoNegocio negocio        = new PuestoNegocio();
                bool?         vFgCompatibles = negocio.ValidarConfiguracionPuestos(SELECCIONPUESTOS.ToString(), vIdPuestoComparar).FirstOrDefault().FG_CONGURADO;

                if (vFgCompatibles == true)
                {
                    ClientScript.RegisterStartupScript(GetType(), "script", "ShowFactoresForm();", true);
                }
                else
                {
                    UtilMensajes.MensajeResultadoDB(rwmAlertas, "La configuración de los puestos seleccionados es diferente.", E_TIPO_RESPUESTA_DB.WARNING, 400, 150, null);
                }
            }
            else
            {
                UtilMensajes.MensajeResultadoDB(rwmAlertas, "Defina la lista de puestos a procesar.", E_TIPO_RESPUESTA_DB.WARNING, 400, 150, null);
            }
        }