コード例 #1
0
        public string Crear(InstalacionEN instalacion)
        {
            try
            {
                SessionInitializeTransaction ();
                if (instalacion.Cliente != null) {
                        instalacion.Cliente = (PalmeralGenNHibernate.EN.Default_.ClienteEN)session.Load (typeof(PalmeralGenNHibernate.EN.Default_.ClienteEN), instalacion.Cliente.Nif);

                        instalacion.Cliente.Instalaciones.Add (instalacion);
                }

                session.Save (instalacion);
                SessionCommit ();
            }

            catch (Exception ex) {
                SessionRollBack ();
                if (ex is PalmeralGenNHibernate.Exceptions.ModelException)
                        throw ex;
                throw new PalmeralGenNHibernate.Exceptions.DataLayerException ("Error in InstalacionCAD.", ex);
            }

            finally
            {
                SessionClose ();
            }

            return instalacion.Id;
        }
コード例 #2
0
        public void Editar(string p_oid, string p_nombre, string p_descripcion, string p_localidad, string p_provincia, string p_pais, string p_direccion, string p_codigoPostal, string p_telefono, float p_metrosCuadrados)
        {
            InstalacionEN instalacionEN = null;

            //Initialized InstalacionEN
            instalacionEN = new InstalacionEN ();
            instalacionEN.Id = p_oid;
            instalacionEN.Nombre = p_nombre;
            instalacionEN.Descripcion = p_descripcion;
            instalacionEN.Localidad = p_localidad;
            instalacionEN.Provincia = p_provincia;
            instalacionEN.Pais = p_pais;
            instalacionEN.Direccion = p_direccion;
            instalacionEN.CodigoPostal = p_codigoPostal;
            instalacionEN.Telefono = p_telefono;
            instalacionEN.MetrosCuadrados = p_metrosCuadrados;
            //Call to InstalacionCAD

            _IInstalacionCAD.Editar (instalacionEN);
        }
コード例 #3
0
        public string Crear(string p_id, string p_nombre, string p_descripcion, string p_localidad, string p_provincia, string p_pais, string p_direccion, string p_codigoPostal, string p_telefono, float p_metrosCuadrados, string p_cliente)
        {
            InstalacionEN instalacionEN = null;
            string oid;

            //Initialized InstalacionEN
            instalacionEN = new InstalacionEN ();
            instalacionEN.Id = p_id;

            instalacionEN.Nombre = p_nombre;

            instalacionEN.Descripcion = p_descripcion;

            instalacionEN.Localidad = p_localidad;

            instalacionEN.Provincia = p_provincia;

            instalacionEN.Pais = p_pais;

            instalacionEN.Direccion = p_direccion;

            instalacionEN.CodigoPostal = p_codigoPostal;

            instalacionEN.Telefono = p_telefono;

            instalacionEN.MetrosCuadrados = p_metrosCuadrados;

            if (p_cliente != null) {
                instalacionEN.Cliente = new PalmeralGenNHibernate.EN.Default_.ClienteEN ();
                instalacionEN.Cliente.Nif = p_cliente;
            }

            //Call to InstalacionCAD

            oid = _IInstalacionCAD.Crear (instalacionEN);
            return oid;
        }
コード例 #4
0
        public void Editar(InstalacionEN instalacion)
        {
            try
            {
                SessionInitializeTransaction ();
                InstalacionEN instalacionEN = (InstalacionEN)session.Load (typeof(InstalacionEN), instalacion.Id);

                instalacionEN.Nombre = instalacion.Nombre;

                instalacionEN.Descripcion = instalacion.Descripcion;

                instalacionEN.Localidad = instalacion.Localidad;

                instalacionEN.Provincia = instalacion.Provincia;

                instalacionEN.Pais = instalacion.Pais;

                instalacionEN.Direccion = instalacion.Direccion;

                instalacionEN.CodigoPostal = instalacion.CodigoPostal;

                instalacionEN.Telefono = instalacion.Telefono;

                instalacionEN.MetrosCuadrados = instalacion.MetrosCuadrados;

                session.Update (instalacionEN);
                SessionCommit ();
            }

            catch (Exception ex) {
                SessionRollBack ();
                if (ex is PalmeralGenNHibernate.Exceptions.ModelException)
                        throw ex;
                throw new PalmeralGenNHibernate.Exceptions.DataLayerException ("Error in InstalacionCAD.", ex);
            }

            finally
            {
                SessionClose ();
            }
        }
コード例 #5
0
        public void Relationer_instalaciones(string p_cliente, System.Collections.Generic.IList<string> p_instalacion)
        {
            PalmeralGenNHibernate.EN.Default_.ClienteEN clienteEN = null;
            try
            {
                SessionInitializeTransaction ();
                clienteEN = (ClienteEN)session.Load (typeof(ClienteEN), p_cliente);
                PalmeralGenNHibernate.EN.Default_.InstalacionEN instalacionesENAux = null;
                if (clienteEN.Instalaciones == null) {
                        clienteEN.Instalaciones = new System.Collections.Generic.List<PalmeralGenNHibernate.EN.Default_.InstalacionEN>();
                }

                foreach (string item in p_instalacion) {
                        instalacionesENAux = new PalmeralGenNHibernate.EN.Default_.InstalacionEN ();
                        instalacionesENAux = (PalmeralGenNHibernate.EN.Default_.InstalacionEN)session.Load (typeof(PalmeralGenNHibernate.EN.Default_.InstalacionEN), item);
                        instalacionesENAux.Cliente = clienteEN;

                        clienteEN.Instalaciones.Add (instalacionesENAux);
                }

                session.Update (clienteEN);
                SessionCommit ();
            }

            catch (Exception ex) {
                SessionRollBack ();
                if (ex is PalmeralGenNHibernate.Exceptions.ModelException)
                        throw ex;
                throw new PalmeralGenNHibernate.Exceptions.DataLayerException ("Error in ClienteCAD.", ex);
            }

            finally
            {
                SessionClose ();
            }
        }
コード例 #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 + "\"");
        }
コード例 #7
0
 public InstalacionEN(InstalacionEN instalacion)
 {
     this.init (instalacion.Id, instalacion.Nombre, instalacion.Descripcion, instalacion.Localidad, instalacion.Provincia, instalacion.Pais, instalacion.Direccion, instalacion.CodigoPostal, instalacion.Telefono, instalacion.MetrosCuadrados, instalacion.Cliente, instalacion.Jornadas, instalacion.Facturas);
 }