Ejemplo n.º 1
0
        public void AddCampo(string nombre, string direccion, string telefono)
        {
            TCampos campo = new TCampos
            {
                Campo     = nombre,
                Direccion = direccion,
                Telefono  = telefono
            };

            Db.TCampos.InsertOnSubmit(campo);
            Db.SubmitChanges();
        }
Ejemplo n.º 2
0
        public static void DibujarSubItemListViewBusqueda(TCampos campo, string clave, object sender, DrawListViewSubItemEventArgs e)
        {
            ListView listView = sender as ListView;

            e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            if (e.Item.Selected)
            {
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(209, 232, 255)), e.Bounds);
                //Usar:
                //TextRenderer.DrawText(e.Graphics, e.SubItem.Text, listView.Font, new Rectangle(new Point(e.Bounds.Location.X + 2, e.Bounds.Location.Y + 1), new Size(e.Bounds.Width - 2, e.Bounds.Height - 1)), SystemColors.HighlightText, TextFormatFlags.ExpandTabs);
                //si el color es muy oscuro y se necesita resaltar el texto en blanco
            }
            else
            {
                if (e.ColumnIndex != 0)
                {
                    e.Graphics.FillRectangle(new SolidBrush(colorBackgroundItem), e.Bounds);
                }
                else
                {
                    e.Graphics.FillRectangle(new SolidBrush(colorBackgroundItem), new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height - Constantes.MARGEN_ABAJO));
                }
            }
            if ((e.SubItem.Text.ToUpperInvariant().Contiene(clave.ToUpperInvariant()) && campo == TCampos.Todos && e.ColumnIndex != Constantes.COLUMNA_CONVOCATORIA && e.ColumnIndex != Constantes.COLUMNA_FECHA_REGISTRO && e.ColumnIndex != Constantes.COLUMNA_ALUMNO_FECHA_INICIO && e.ColumnIndex != Constantes.COLUMNA_FECHA_DEFENSA) || (e.SubItem.Text.ToUpperInvariant().Contiene(clave.ToUpperInvariant()) && campo == TCampos.Titulo && e.ColumnIndex == 0) || (e.SubItem.Text.ToUpperInvariant().Contiene(clave.ToUpperInvariant()) && campo == TCampos.Descripcion && e.ColumnIndex == 1) || (e.SubItem.Text.ToUpperInvariant().Contiene(clave.ToUpperInvariant()) && campo == TCampos.Alumno && (e.ColumnIndex == 3 || e.ColumnIndex == 4 || e.ColumnIndex == 5 || e.ColumnIndex == 6)))
            {
                int    indiceClave         = e.SubItem.Text.ToUpperInvariant().IndexOf(clave.ToUpperInvariant());
                string textoClave          = e.SubItem.Text.Substring(indiceClave, clave.Length);
                string textoDespuesDeClave = e.SubItem.Text.Substring(indiceClave + clave.Length);
                string textoAntesDeClave   = e.SubItem.Text.Substring(0, e.SubItem.Text.Length - textoClave.Length - textoDespuesDeClave.Length);


                Size sz  = TextRenderer.MeasureText(textoAntesDeClave, fuenteItem);
                Size sz2 = TextRenderer.MeasureText(textoClave, fuenteItem);
                Size sz3 = TextRenderer.MeasureText(textoDespuesDeClave, fuenteItem);

                if (textoAntesDeClave.Length > 0)
                {
                    TextRenderer.DrawText(e.Graphics, textoAntesDeClave, fuenteItem, new Rectangle(new Point(e.Bounds.Location.X + Constantes.MARGEN_IZQUIERDO, e.Bounds.Location.Y + Constantes.MARGEN_ABAJO), sz), colorTextoItem, TextFormatFlags.ExpandTabs);
                }
                TextRenderer.DrawText(e.Graphics, textoClave, fuenteItem, new Rectangle(new Point(e.Bounds.Location.X - Constantes.MARGEN_IZQUIERDO + ((textoAntesDeClave.Length > 0) ? -Constantes.MARGEN_TEXTO_RESALTADO_IZQUIERDO : +Constantes.MARGEN_IZQUIERDO) + sz.Width, e.Bounds.Location.Y + Constantes.MARGEN_ABAJO), new Size((textoDespuesDeClave.Length > 0) ? sz2.Width : (e.Bounds.Width - sz.Width + Constantes.MARGEN_IZQUIERDO + Constantes.MARGEN_TEXTO_RESALTADO_IZQUIERDO), sz2.Height)), colorTextoItem, Color.Yellow, TextFormatFlags.ExpandTabs);
                if (textoDespuesDeClave.Length > 0)
                {
                    TextRenderer.DrawText(e.Graphics, textoDespuesDeClave, fuenteItem, new Rectangle(new Point(e.Bounds.Location.X - Constantes.MARGEN_IZQUIERDO - ((textoAntesDeClave.Length > 0) ? Constantes.MARGEN_TEXTO_RESALTADO_IZQUIERDO_AL_FINAL : Constantes.MARGEN_IZQUIERDO + Constantes.MARGEN_TEXTO_RESALTADO_IZQUIERDO) + sz.Width + sz2.Width, e.Bounds.Location.Y + Constantes.MARGEN_ABAJO), new Size(e.Bounds.Width - sz.Width - sz2.Width + Constantes.MARGEN_IZQUIERDO + Constantes.MARGEN_TEXTO_RESALTADO_IZQUIERDO_AL_FINAL, sz3.Height)), colorTextoItem, TextFormatFlags.ExpandTabs);
                }
            }

            else
            {
                TextRenderer.DrawText(e.Graphics, e.SubItem.Text, fuenteItem, new Rectangle(new Point(e.Bounds.Location.X + Constantes.MARGEN_IZQUIERDO, e.Bounds.Location.Y + Constantes.MARGEN_ABAJO), new Size(e.Bounds.Width - Constantes.MARGEN_IZQUIERDO, e.Bounds.Height - Constantes.MARGEN_ABAJO)), colorTextoItem, TextFormatFlags.ExpandTabs);
            }
        }
Ejemplo n.º 3
0
        public void BuscarProyecto(string clave, TCampos campo, int index1, int index2, int index3, int index4, DateTimePicker date1, DateTimePicker date2, DateTimePicker date3, NumericUpDown number, LeerEscribirArchivo fichero)
        {
            MListaProyectos.getMListaProyectos.getMProyectos.Buscar(campo, clave);
            bool filtro = FiltrarProyecto(index1, index2, index3, index4, date1, date2, date3, number);


            if (MListaProyectos.getMListaProyectos.getMProyectos.Proyectos[3].Count > 0)
            {
                new Form4(ventanaPadre, clave, campo, index1, index2, index3, index4, date1.Value, date2.Value, date3.Value, number.Value, filtro, fichero).ShowDialog(ventanaPadre);
            }
            else
            {
                MessageBox.Show("No se han encontrado proyectos que coincidan con los parámetros de búsqueda.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Ejemplo n.º 4
0
        public Form4(Form1 ventanaPadre, string busqueda, TCampos campo, int index1, int index2, int index3, int index4, DateTime date1, DateTime date2, DateTime date3, decimal nota, bool filtro, LeerEscribirArchivo fichero)
        {
            InitializeComponent();
            toolStrip1.Renderer = new ToolStripVisualStyles.ToolStripAeroRenderer(ToolStripVisualStyles.ToolbarTheme.Toolbar);
            this.fichero        = fichero;
            vista             = new VistaGrafica();
            copiar            = new Copiar(copiarPorCampoToolStripMenuItem);
            this.ventanaPadre = ventanaPadre;
            this.busqueda     = busqueda;
            this.campo        = campo;

            toolStripStatusLabel1.Text += busqueda;
            if (index1 + index2 + index3 + index4 > 0 && filtro)
            {
                toolStripStatusLabel2.Text = " Filtro:";
                if (index1 * index2 * index3 * index4 != 0)
                {
                    toolStripStatusLabel2.Text = " Filtros:";
                }
                switch (index1)
                {
                case 1:
                    toolStripStatusLabel2.Text += " fecha de registro posterior a " + date1.Day + "/" + date1.Month + "/" + date1.Year;
                    break;

                case 2:
                    toolStripStatusLabel2.Text += " fecha de registro anterior a " + date1.Day + "/" + date1.Month + "/" + date1.Year;
                    break;

                case 3:
                    toolStripStatusLabel2.Text += " fecha de registro igual a " + date1.Day + "/" + date1.Month + "/" + date1.Year;
                    break;
                }
                if (index2 != 0)
                {
                    toolStripStatusLabel2.Text += ";";
                }
                switch (index2)
                {
                case 1:
                    toolStripStatusLabel2.Text += " fecha de inicio posterior a " + date2.Day + "/" + date2.Month + "/" + date2.Year;
                    break;

                case 2:
                    toolStripStatusLabel2.Text += " fecha de inicio anterior a " + date2.Day + "/" + date2.Month + "/" + date2.Year;
                    break;

                case 3:
                    toolStripStatusLabel2.Text += " fecha de inicio igual a " + date2.Day + "/" + date2.Month + "/" + date2.Year;
                    break;
                }
                if (index3 != 0)
                {
                    toolStripStatusLabel2.Text += ";";
                }
                switch (index3)
                {
                case 1:
                    toolStripStatusLabel2.Text += " fecha de defensa posterior a " + date3.Day + "/" + date3.Month + "/" + date3.Year;
                    break;

                case 2:
                    toolStripStatusLabel2.Text += " fecha de defensa anterior a " + date3.Day + "/" + date3.Month + "/" + date3.Year;
                    break;

                case 3:
                    toolStripStatusLabel2.Text += " fecha de defensa igual a " + date3.Day + "/" + date3.Month + "/" + date3.Year;
                    break;
                }
                if (index4 != 0)
                {
                    toolStripStatusLabel2.Text += ";";
                }
                switch (index4)
                {
                case 1:
                    toolStripStatusLabel2.Text += " nota superior a " + nota;
                    break;

                case 2:
                    toolStripStatusLabel2.Text += " nota superior o igual a " + nota;
                    break;

                case 3:
                    toolStripStatusLabel2.Text += " nota inferior a " + nota;
                    break;

                case 4:
                    toolStripStatusLabel2.Text += " nota inferior o igual a " + nota;
                    break;

                case 5:
                    toolStripStatusLabel2.Text += " nota igual a " + nota;
                    break;
                }
            }
            contextMenuStrip1.Renderer = new ToolStripVisualStyles.ToolStripAeroRenderer(ToolStripVisualStyles.ToolbarTheme.HelpBar);
            vista.ActualizarVistaTabla(ref listView1, TipoLista.Busqueda);
            toolStripStatusLabel3.Text = listView1.Items.Count + " proyectos";
        }