Example #1
0
        protected DataTable loadDataTable()
        {
            DataTable DT = new DataTable();

            string sType = Request.QueryString["t"];

            if (sType != null)
            {
                if (sType == "candidato")
                {
                    var candidatos = InformacionPersonalCandidatoService.GetCandidatos();
                    if (candidatos != null)
                    {
                        DT.Clear();
                        DT.Columns.AddRange(new DataColumn[]
                        {
                            new DataColumn("Nombre"),
                            new DataColumn("Apellido"),
                            new DataColumn("Correo"),
                            new DataColumn("Telefono"),
                            new DataColumn("Nacionalidad"),
                            new DataColumn("RFC"),
                            new DataColumn("Direccion")
                        });

                        foreach (var cand in candidatos)
                        {
                            DT.Rows.Add(new object[]
                            {
                                cand.Nombre,
                                cand.Apellido,
                                cand.Correo,
                                cand.Telefono,
                                cand.Nacionalidad,
                                cand.RFC,
                                cand.Direccion
                            });

                            DT.AcceptChanges();
                        }
                    }
                }

                else if (sType == "juez")
                {
                    var jueces = InformacionPersonalJuezService.GetJueces();
                    if (jueces != null)
                    {
                        DT.Clear();
                        DT.Columns.AddRange(new DataColumn[]
                        {
                            new DataColumn("Nombre"),
                            new DataColumn("Apellido"),
                            new DataColumn("Correo")
                        });

                        foreach (var juez in jueces)
                        {
                            DT.Rows.Add(new object[]
                            {
                                juez.Nombre,
                                juez.Apellido,
                                juez.Correo
                            });

                            DT.AcceptChanges();
                        }
                    }
                }
            }

            return(DT);
        }
Example #2
0
        private void LoadCandidateTable()
        {
            litUsuarios.Text = "Candidatos";
            var    candidatos = InformacionPersonalCandidatoService.GetCandidatos();
            string sType      = Request.QueryString["t"];

            if (candidatos != null)
            {
                foreach (var cand in candidatos)
                {
                    TableRow tr = new TableRow();

                    // profile image column
                    TableCell tdIP = new TableCell();
                    tdIP.CssClass = "dt-profile-pic";
                    tdIP.Attributes.Add("onclick", "window.open('AdministraInformacionPersonal.aspx?id=" + cand.cveCandidato + "&t=" + sType + "');");
                    Image ipImage = new Image();
                    if (cand.NombreImagen != null)
                    {
                        ipImage.ImageUrl = "/ProfilePictures/" + cand.NombreImagen;
                    }
                    else
                    {
                        ipImage.ImageUrl = "/Resources/img/default-pp.jpg";
                    }
                    ipImage.CssClass      = "avatar img-circle";
                    ipImage.AlternateText = "avatar";
                    ipImage.Style.Add("width", "28px");
                    ipImage.Style.Add("height", "28px");

                    tdIP.Controls.Add(ipImage);

                    // name column
                    TableCell tdName = new TableCell();
                    tdName.Text = cand.Nombre;
                    tdName.Attributes.Add("onclick", "window.open('AdministraInformacionPersonal.aspx?id=" + cand.cveCandidato + "&t=" + sType + "');");

                    // last name column
                    TableCell tdLastName = new TableCell();
                    tdLastName.Text = cand.Apellido;
                    tdLastName.Attributes.Add("onclick", "window.open('AdministraInformacionPersonal.aspx?id=" + cand.cveCandidato + "&t=" + sType + "');");

                    TableCell      tdEmail    = new TableCell();
                    LiteralControl lcMailLink = new LiteralControl("<a href=\"mailto:" + cand.Correo + "?Subject=Premios%20Institucionales\" target=\"_top\"> " + cand.Correo + "</a>");
                    tdEmail.Controls.Add(lcMailLink);

                    TableCell tdPhone = new TableCell();
                    tdPhone.Text = cand.Telefono;
                    tdPhone.Attributes.Add("onclick", "window.open('AdministraInformacionPersonal.aspx?id=" + cand.cveCandidato + "&t=" + sType + "');");

                    TableCell tdNationality = new TableCell();
                    tdNationality.Text = cand.Nacionalidad;
                    tdNationality.Attributes.Add("onclick", "window.open('AdministraInformacionPersonal.aspx?id=" + cand.cveCandidato + "&t=" + sType + "');");

                    TableCell tdRFC = new TableCell();
                    tdRFC.Text = cand.RFC;
                    tdRFC.Attributes.Add("onclick", "window.open('AdministraInformacionPersonal.aspx?id=" + cand.cveCandidato + "&t=" + sType + "');");

                    TableCell tdAddress = new TableCell();
                    tdAddress.Text = cand.Direccion;
                    tdAddress.Attributes.Add("onclick", "window.open('AdministraInformacionPersonal.aspx?id=" + cand.cveCandidato + "&t=" + sType + "');");

                    TableCell tdConfirmacion = new TableCell();
                    tdConfirmacion.Attributes.Add("onclick", "window.open('AdministraInformacionPersonal.aspx?id=" + cand.cveCandidato + "&t=" + sType + "');");
                    LiteralControl lcConfirmacion;
                    if (cand.Confirmado.HasValue && cand.Confirmado.Value)
                    {
                        tdConfirmacion.Style.Add("color", "#4caf50");
                        lcConfirmacion = new LiteralControl("<strong> <div style=\"display: none; \"> 2 </div> Confirmado </strong>");
                    }
                    else
                    {
                        tdConfirmacion.Style.Add("color", "#f9a825");
                        lcConfirmacion = new LiteralControl("<strong> <div style=\"display: none; \"> 2 </div> Sin confirmar </strong>");
                    }
                    tdConfirmacion.Controls.Add(lcConfirmacion);

                    // status column
                    TableCell tdPrivacidad = new TableCell();
                    tdPrivacidad.Attributes.Add("onclick", "window.open('AdministraInformacionPersonal.aspx?id=" + cand.cveCandidato + "&t=" + sType + "');");
                    LiteralControl lcPrivacidad;
                    if (cand.FechaPrivacidadDatos != null)
                    {
                        tdPrivacidad.Style.Add("color", "#4caf50");
                        lcPrivacidad = new LiteralControl("<strong> <div style=\"display: none; \"> 2 </div> Aceptado </strong>");
                    }
                    else
                    {
                        tdPrivacidad.Style.Add("color", "#f9a825");
                        lcPrivacidad = new LiteralControl("<strong> <div style=\"display: none; \"> 2 </div> Sin aceptar </strong>");
                    }

                    tdPrivacidad.Controls.Add(lcPrivacidad);

                    tr.Controls.Add(tdIP);
                    tr.Controls.Add(tdName);
                    tr.Controls.Add(tdLastName);
                    tr.Controls.Add(tdEmail);
                    tr.Controls.Add(tdPhone);
                    tr.Controls.Add(tdNationality);
                    tr.Controls.Add(tdRFC);
                    tr.Controls.Add(tdAddress);
                    tr.Controls.Add(tdConfirmacion);
                    tr.Controls.Add(tdPrivacidad);

                    listaCandidatosTableBody.Controls.Add(tr);
                }
            }
        }