public ConsultarInstalacion(string id)
        {
            InitializeComponent();
            InstalacionCEN _inst = new InstalacionCEN();
            InstalacionEN inst = _inst.ObtenerInstalacion(id);
            idBox.Text = inst.Id;
            nombreBox.Text = inst.Nombre;
            direccionBox.Text = inst.Direccion;
            localidadBox.Text = inst.Localidad;
            provinciaBox.Text = inst.Provincia;
            paisBox.Text = inst.Pais;
            codigoPostalBox.Text = inst.CodigoPostal;
            telefonoBox.Text = inst.Telefono;
            m2Box.Text = inst.MetrosCuadrados.ToString();
            clienteBox.Text = inst.Cliente.Nif;
            descripcionBox.Text = inst.Descripcion;

            idBox.Enabled = false;
            nombreBox.Enabled = false;
            direccionBox.Enabled = false;
            localidadBox.Enabled = false;
            provinciaBox.Enabled = false;
            paisBox.Enabled = false;
            codigoPostalBox.Enabled = false;
            telefonoBox.Enabled = false;
            m2Box.Enabled = false;
            clienteBox.Enabled = false;
            descripcionBox.Enabled = false;

            TrabajadorCEN _trab = new TrabajadorCEN();
            IList<TrabajadorEN> trab = _trab.ObtenerTodos(0, 0);
            gridTrabajadores.DataSource = trab;
        }
 public ConsultarEditarNominas(string id, string traId, bool editar)
 {
     InitializeComponent();
     ParteFijaBox.TextChanged += new EventHandler(CalcularTotal);
     ParteVariableBox.TextChanged += new EventHandler(CalcularTotal);
     TrabajadorCEN trabajador = new TrabajadorCEN();
     IList<TrabajadorEN> lista = new List<TrabajadorEN>();
     lista = trabajador.ObtenerTodos(0, 0);
     if (lista.Contains(trabajador.ObtenerTrabajador(traId)))
     {
         if (trabajador.ObtenerTrabajador(traId).Tipo.Equals(PalmeralGenNHibernate.Enumerated.Default_.TipoEmpleoEnum.Cooperativista))
         {
             RellenarCampos(id, true);
             if (editar)
             {
                 ActivarCampos(true);
             }
         }
         else
         {
             RellenarCampos(id, false);
             if (editar)
             {
                 ActivarCampos(false);
             }
         }
     }
 }
        public InformeInstalacion(string id)
        {
            InitializeComponent();

            labelNombreEmpresa.Text = Constantes._NOMBREEMPRESA;
            labelFechaInforme.Text = DateTime.Now.ToString();
            labelCiudadInforme.Text = Constantes._CIUDADEMPRESA;

            InstalacionCEN _inst = new InstalacionCEN();
            InstalacionEN inst = _inst.ObtenerInstalacion(id);
            id_instalacion = inst.Id;
            idBox.Text = inst.Id;
            nombreBox.Text = inst.Nombre;
            direccionBox.Text = inst.Direccion;
            localidadBox.Text = inst.Localidad;
            provinciaBox.Text = inst.Provincia;
            paisBox.Text = inst.Pais;
            codigoPostalBox.Text = inst.CodigoPostal;
            telefonoBox.Text = inst.Telefono;
            m2Box.Text = inst.MetrosCuadrados.ToString();
            clienteBox.Text = inst.Cliente.Nif;
            descripcionBox.Text = inst.Descripcion;

            idBox.Enabled = false;
            nombreBox.Enabled = false;
            direccionBox.Enabled = false;
            localidadBox.Enabled = false;
            provinciaBox.Enabled = false;
            paisBox.Enabled = false;
            codigoPostalBox.Enabled = false;
            telefonoBox.Enabled = false;
            m2Box.Enabled = false;
            clienteBox.Enabled = false;
            descripcionBox.Enabled = false;

            IList<TrabajadorEN> lista = new List<TrabajadorEN>();
            TrabajadorCEN trabajador = new TrabajadorCEN();
            lista = trabajador.ObtenerTodos(0, 0);
            gridInstalaciones.DataSource = lista;
        }
Пример #4
0
        public void Grid_Load(object sender, EventArgs e)
        {
            try
            {
                TrabajadorCEN trabajador = new TrabajadorCEN();
                IList<TrabajadorEN> listaT = trabajador.ObtenerTodos(0, 0);
                Trabajadores.DataSource = convertirTrabajadorGV(listaT);

                InstalacionCEN instalacion = new InstalacionCEN();
                IList<InstalacionEN> listaI = instalacion.ObtenerTodas(0, 0);
                Instalaciones.DataSource = convertirInstalacionGV(listaI);

                JornadaFechaCEN jornada = new JornadaFechaCEN();
                IList<JornadaFechaEN> listaJ = jornada.ObtenerTodas(0, 0);
                IList<JGV> listajornadas = convertirJornadaGV(listaJ);
                Jornada.DataSource = listajornadas;

            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Пример #5
0
        private void Trabajadores_Changed(object sender, EventArgs e)
        {
            TrabajadorCEN tra = new TrabajadorCEN();
            IList<TrabajadorEN> trabajador = new List<TrabajadorEN>();
            trabajador = tra.ObtenerTodos(0, 0);

            if(trabajador.Contains(tra.ObtenerTrabajador(Trabajadores.SelectedItem.ToString())))
            {
                Variable_Box.Text = "";
                Fija_Box.Text = "";
                Horas_Box.Text = "";
                Total_Box.Text = "";

                if (tra.ObtenerTrabajador(Trabajadores.SelectedItem.ToString()).Tipo.Equals(PalmeralGenNHibernate.Enumerated.Default_.TipoEmpleoEnum.Cooperativista))
                {
                    Variable.Visible = true;
                    Variable_Box.Visible = true;
                    Fija.Visible = true;
                    Fija_Box.Visible = true;
                    Horas.Visible = true;
                    Horas_Box.Visible = true;
                    Total.Visible = true;
                    Total_Box.Visible = true;
                    Fecha1.Visible = true;
                    Fecha2.Visible = true;
                    Mes_Box.Visible = true;
                    Anyo_Box.Visible = true;
                    Crear.Enabled = true;
                }
                else if (tra.ObtenerTrabajador(Trabajadores.SelectedItem.ToString()).Tipo.Equals(PalmeralGenNHibernate.Enumerated.Default_.TipoEmpleoEnum.Empleado))
                {
                    Variable.Visible = false;
                    Variable_Box.Visible = false;
                    Fija_Box.Visible = true;
                    Fija.Visible = true;
                    Horas.Visible = true;
                    Horas_Box.Visible = true;
                    Total.Visible = true;
                    Total_Box.Visible = true;
                    Fecha1.Visible = true;
                    Fecha2.Visible = true;
                    Mes_Box.Visible = true;
                    Anyo_Box.Visible = true;
                    Crear.Enabled = true;
                }
            }
            else
            {
                Variable.Visible = false;
                Variable_Box.Visible = false;
                Fija.Visible = false;
                Fija_Box.Visible = false;
                Horas.Visible = false;
                Horas_Box.Visible = false;
                Total.Visible = false;
                Total_Box.Visible = false;
                Fecha1.Visible = false;
                Fecha2.Visible = false;
                Mes_Box.Visible = false;
                Anyo_Box.Visible = false;
                Crear.Enabled = false;
            }
        }
Пример #6
0
        public void pdfInstalacion(InstalacionEN instalacion)
        {
            Document document;
            document = new Document(PageSize.A4, 25, 25, 30, 30);
            string path = @"" + "Instalación " + instalacion.Id + ".pdf";
            FileStream fs = new FileStream(path, FileMode.OpenOrCreate);

            // Create an instance to the PDF file by creating an instance of the PDF
            // Writer class using the document and the filestrem in the constructor.
            PdfWriter writer = PdfWriter.GetInstance(document, fs);

            // Open the document to enable you to write to the document
            document.Open();

            // Creo cabecera del informe
            PdfPTable tableTitulo = new PdfPTable(2);
            tableTitulo.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            PdfPCell cell = new PdfPCell(new Phrase("Informe de Instalación"));
            cell.BorderWidth = 0;
            cell.Colspan = 3;
            cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
            tableTitulo.AddCell(cell);
            document.Add(tableTitulo);

            //Tabla sin bordes
            PdfPTable tableCabecera = new PdfPTable(2);
            tableCabecera.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;

            //Cargamos la imagen de resources.
            System.Drawing.Image logores = Properties.Resources.logo;
            iTextSharp.text.Image logo = iTextSharp.text.Image.GetInstance(logores, System.Drawing.Imaging.ImageFormat.Jpeg);

            //Añado imagen a la cabecera y fecha.
            logo.ScaleAbsolute(100f, 100f);
            PdfPCell cellLogo = new PdfPCell(logo);
            cellLogo.BorderWidth = 0;
            tableCabecera.AddCell(cellLogo);
            tableCabecera.AddCell("\n\n\n\n\nEmpresa: " + Constantes._NOMBREEMPRESA + "\nLocalidad: "
                + Constantes._CIUDADEMPRESA + "\nFecha: " + DateTime.Now.ToString() + "\n");

            //Inserto tabla de cabecera
            document.Add(tableCabecera);

            Paragraph salto = new Paragraph(" ");
            document.Add(salto);
            document.Add(salto);

            //Añadimos una tabla con los datos de la instalacion
            PdfPTable tableInstalacion = new PdfPTable(2);
            PdfPCell cell2 = new PdfPCell(new Phrase("Datos de la instalación"));
            cell2.Colspan = 2;
            cell2.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
            tableInstalacion.AddCell(cell2);
            tableInstalacion.AddCell("ID");
            tableInstalacion.AddCell(instalacion.Id);
            tableInstalacion.AddCell("Nombre");
            tableInstalacion.AddCell(instalacion.Nombre);
            tableInstalacion.AddCell("Descripción");
            tableInstalacion.AddCell(instalacion.Descripcion);
            tableInstalacion.AddCell("Dirección");
            tableInstalacion.AddCell(instalacion.Direccion);
            tableInstalacion.AddCell("Localidad");
            tableInstalacion.AddCell(instalacion.Localidad);
            tableInstalacion.AddCell("Provincia");
            tableInstalacion.AddCell(instalacion.Provincia);
            tableInstalacion.AddCell("País");
            tableInstalacion.AddCell(instalacion.Pais);
            tableInstalacion.AddCell("CP");
            tableInstalacion.AddCell(instalacion.CodigoPostal);
            tableInstalacion.AddCell("Teléfono");
            tableInstalacion.AddCell(instalacion.Telefono);
            tableInstalacion.AddCell("Metros cuadrados");
            tableInstalacion.AddCell(instalacion.MetrosCuadrados.ToString());
            tableInstalacion.AddCell("NIF Cliente");
            tableInstalacion.AddCell(instalacion.Cliente.Nif);
            document.Add(tableInstalacion);

            document.Add(salto);
            document.Add(salto);

            //Añadimos una tabla con los datos delos trabajadores
            PdfPTable tableTrabajadores = new PdfPTable(7);
            tableTrabajadores.TotalWidth = 500f;
            tableTrabajadores.LockedWidth = true;
            PdfPCell cell3 = new PdfPCell(new Phrase("Trabajadores de la instalación"));
            cell3.Colspan = 9;
            cell3.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
            tableTrabajadores.AddCell(cell3);
            tableTrabajadores.AddCell("NIF");
            tableTrabajadores.AddCell("Nombre");
            tableTrabajadores.AddCell("Apellidos");
            tableTrabajadores.AddCell("Dirección");
            tableTrabajadores.AddCell("Localidad");
            tableTrabajadores.AddCell("Teléfono");
            tableTrabajadores.AddCell("Tipo");
            TrabajadorCEN trabajadorCEN = new TrabajadorCEN();
            IList<TrabajadorEN> trabajadoresInst = trabajadorCEN.ObtenerTodos(0, 0);

            foreach (TrabajadorEN trab in trabajadoresInst)
            {
                tableTrabajadores.AddCell(trab.Nif);
                tableTrabajadores.AddCell(trab.Nombre);
                tableTrabajadores.AddCell(trab.Apellidos);
                tableTrabajadores.AddCell(trab.Direccion);
                tableTrabajadores.AddCell(trab.Localidad);
                tableTrabajadores.AddCell(trab.Telefono);
                tableTrabajadores.AddCell(trab.Tipo.ToString());
            }

            document.Add(tableTrabajadores);

            //Cerramos todo
            document.Close();
            writer.Close();
            fs.Close();

            MessageBox.Show("Se ha generado un informe en PDF con el nombre \"" + path + "\"");
        }
        private void Buscar_Trabajadores(object sender, EventArgs e)
        {
            TrabajadorCEN trabajador = new TrabajadorCEN();
            IList<TrabajadorEN> lista;
            if (Premisa.Text == "" || Buscador.Text == "")
            {
                Buscador.Visible = true;
                BusquedaTipo.Visible = false;
                lista = trabajador.ObtenerTodos(0, 0);
                Mostrar.DataSource = Convertir_TrabajadorGW(lista);
                ComprobarLista(lista);
            }
            if (Premisa.Text.Equals("Provincia"))
            {
                Buscador.Visible = true;
                BusquedaTipo.Visible = false;
                lista=trabajador.BuscarPorProvincia(Buscador.Text);
                Mostrar.DataSource = Convertir_TrabajadorGW(lista);
                ComprobarLista(lista);
            }
            else if (Premisa.Text.Equals("Localidad"))
            {
                Buscador.Visible = true;
                BusquedaTipo.Visible = false;
                lista = trabajador.BuscarPorLocalidad(Buscador.Text);
                Mostrar.DataSource = Convertir_TrabajadorGW(lista);
                ComprobarLista(lista);
            }
            else if (Premisa.Text.Equals("Nombre"))
            {
                Buscador.Visible = true;
                BusquedaTipo.Visible = false;
                lista = trabajador.BuscarPorNombre(Buscador.Text);
                Mostrar.DataSource = Convertir_TrabajadorGW(lista);
                ComprobarLista(lista);
            }
            else if (Premisa.Text.Equals("Tipo"))
            {
                Buscador.Visible = false;
                BusquedaTipo.Visible = true;
                if (BusquedaTipo.SelectedIndex == 0)
                {
                    try {
                        lista = trabajador.BuscarPorTipo(PalmeralGenNHibernate.Enumerated.Default_.TipoEmpleoEnum.Cooperativista);
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show(exc.Message);
                        throw exc;
                    }

                    Mostrar.DataSource = Convertir_TrabajadorGW(lista);
                    ComprobarLista(lista);
                }
                else if (BusquedaTipo.SelectedIndex == 1)
                {
                    lista = trabajador.BuscarPorTipo(PalmeralGenNHibernate.Enumerated.Default_.TipoEmpleoEnum.Empleado);
                    Mostrar.DataSource = Convertir_TrabajadorGW(lista);
                    ComprobarLista(lista);
                }
                else
                {
                    lista = trabajador.ObtenerTodos(0, 0);
                    Mostrar.DataSource = Convertir_TrabajadorGW(lista);
                    ComprobarLista(lista);
                }
            }
        }
 private void Grid_Load(object sender, EventArgs e)
 {
     TrabajadorCEN trabajador = new TrabajadorCEN();
     IList<TrabajadorEN> lista;
     lista=trabajador.ObtenerTodos(0, 0);
     Mostrar.DataSource = Convertir_TrabajadorGW(lista);
     ComprobarLista(lista);
 }
 private void GenerarListado_Click(object sender, EventArgs e)
 {
     TrabajadorCEN trabajador = new TrabajadorCEN();
     IList<TrabajadorEN> generartrabajador = trabajador.ObtenerTodos(0,0);
     GeneradorPDF pdf = new GeneradorPDF();
     pdf.pdfTrabajadorListado(generartrabajador);
 }
 private void Editar_Click(object sender, EventArgs e)
 {
     TrabajadorCEN trabajador = new TrabajadorCEN();
     IList<TrabajadorEN> lista = new List<TrabajadorEN>();
     lista = trabajador.ObtenerTodos(0, 0);
     if (lista.Contains(trabajador.ObtenerTrabajador(TrabajadorBox.Text)))
     {
         if (trabajador.ObtenerTrabajador(TrabajadorBox.Text).Tipo.Equals(PalmeralGenNHibernate.Enumerated.Default_.TipoEmpleoEnum.Cooperativista))
         {
             ActivarCampos(true);
         }
         else
         {
             ActivarCampos(false);
         }
     }
 }