public string Crear(string p_nif, string p_nombre, string p_descripcion, string p_email, string p_localidad, string p_provincia, string p_pais, string p_direccion, string p_codigoPostal, string p_telefono)
        {
            ClienteEN clienteEN = null;
            string oid;

            //Initialized ClienteEN
            clienteEN = new ClienteEN ();
            clienteEN.Nif = p_nif;

            clienteEN.Nombre = p_nombre;

            clienteEN.Descripcion = p_descripcion;

            clienteEN.Email = p_email;

            clienteEN.Localidad = p_localidad;

            clienteEN.Provincia = p_provincia;

            clienteEN.Pais = p_pais;

            clienteEN.Direccion = p_direccion;

            clienteEN.CodigoPostal = p_codigoPostal;

            clienteEN.Telefono = p_telefono;

            //Call to ClienteCAD

            oid = _IClienteCAD.Crear (clienteEN);
            return oid;
        }
 public GenerarInforme(ClienteEN cliente2)
 {
     InitializeComponent();
     nifcliente = cliente2.Nif;
     pintarCabeceraEmpresa();
     pintarDatosCliente(cliente2);
     pintarInstalaciones();
 }
 public GenerarInforme(string nif)
 {
     InitializeComponent();
     ClienteCEN clienteCEN = new ClienteCEN();
     cliente = clienteCEN.ObtenerCliente(nif);
     nifcliente = nif;
     pintarCabeceraEmpresa();
     pintarDatosCliente();
     pintarInstalaciones();
 }
        public string Crear(ClienteEN cliente)
        {
            try
            {
                SessionInitializeTransaction ();

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

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

            finally
            {
                SessionClose ();
            }

            return cliente.Nif;
        }
        public void Editar(ClienteEN cliente)
        {
            try
            {
                SessionInitializeTransaction ();
                ClienteEN clienteEN = (ClienteEN)session.Load (typeof(ClienteEN), cliente.Nif);

                clienteEN.Nombre = cliente.Nombre;

                clienteEN.Descripcion = cliente.Descripcion;

                clienteEN.Email = cliente.Email;

                clienteEN.Localidad = cliente.Localidad;

                clienteEN.Provincia = cliente.Provincia;

                clienteEN.Pais = cliente.Pais;

                clienteEN.Direccion = cliente.Direccion;

                clienteEN.CodigoPostal = cliente.CodigoPostal;

                clienteEN.Telefono = cliente.Telefono;

                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 ();
            }
        }
 public EliminarCliente(ClienteEN cliente)
 {
     InitializeComponent();
     pintarDatos(cliente);
 }
        private void pintarDatos(ClienteEN cliente)
        {
            textBoxNombre.Text = cliente.Nombre.ToString();
            textBoxNIF.Text = cliente.Nif.ToString();

            IList<InstalacionEN> lista = new List<InstalacionEN>();
            IList<InstalacionEN> lista2 = new List<InstalacionEN>();

            InstalacionCEN instalacion = new InstalacionCEN();
            lista = instalacion.ObtenerTodas(0, 0);
            foreach (InstalacionEN i in lista)
            {
                if (i.Cliente.Nif == cliente.Nif)
                {
                    lista2.Add(i);
                }
            }

            dataGridViewInstalaciones.DataSource = convertirGV(lista2);
        }
        public void pdfCliente(ClienteEN cliente)
        {
            Document document;
            document = new Document(PageSize.A4, 25, 25, 30, 30);
            string path = @"" + "Cliente " + cliente.Nif + ".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 Cliente"));
            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 del cliente
            PdfPTable tableCliente = new PdfPTable(2);
            PdfPCell cell2 = new PdfPCell(new Phrase("Datos del Cliente"));
            cell2.Colspan = 2;
            cell2.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
            tableCliente.AddCell(cell2);
            tableCliente.AddCell("NIF");
            tableCliente.AddCell(cliente.Nif);
            tableCliente.AddCell("Nombre");
            tableCliente.AddCell(cliente.Nombre);
            tableCliente.AddCell("Email");
            tableCliente.AddCell(cliente.Email);
            tableCliente.AddCell("Dirección");
            tableCliente.AddCell(cliente.Direccion);
            tableCliente.AddCell("Localidad");
            tableCliente.AddCell(cliente.Localidad);
            tableCliente.AddCell("Provincia");
            tableCliente.AddCell(cliente.Provincia);
            tableCliente.AddCell("CP");
            tableCliente.AddCell(cliente.CodigoPostal);
            tableCliente.AddCell("País");
            tableCliente.AddCell(cliente.Pais);
            tableCliente.AddCell("Teléfono");
            tableCliente.AddCell(cliente.Telefono);
            tableCliente.AddCell("Descripción");
            tableCliente.AddCell(cliente.Descripcion);
            document.Add(tableCliente);

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

            //Añadimos una tabla con los datos del cliente
            PdfPTable tableInstalaciones = new PdfPTable(7);
            tableInstalaciones.TotalWidth = 500f;
            tableInstalaciones.LockedWidth = true;
            PdfPCell cell3 = new PdfPCell(new Phrase("Instalaciones del Cliente"));
            cell3.Colspan = 7;
            cell3.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
            tableInstalaciones.AddCell(cell3);
            tableInstalaciones.AddCell("Nombre");
            tableInstalaciones.AddCell("Dirección");
            tableInstalaciones.AddCell("Localidad");
            tableInstalaciones.AddCell("Provincia");
            tableInstalaciones.AddCell("CP");
            tableInstalaciones.AddCell("País");
            tableInstalaciones.AddCell("Teléfono");
            InstalacionCEN instalacionCEN = new InstalacionCEN();
            IList<InstalacionEN> instalacionesCliente = new List<InstalacionEN>();
            instalacionesCliente = instalacionCEN.BuscarInstalacionesCliente(cliente.Nif);

            foreach (InstalacionEN ins in instalacionesCliente)
            {
                tableInstalaciones.AddCell(ins.Nombre);
                tableInstalaciones.AddCell(ins.Direccion);
                tableInstalaciones.AddCell(ins.Localidad);
                tableInstalaciones.AddCell(ins.Provincia);
                tableInstalaciones.AddCell(ins.CodigoPostal);
                tableInstalaciones.AddCell(ins.Pais);
                tableInstalaciones.AddCell(ins.Telefono);
            }
            document.Add(tableInstalaciones);

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

            MessageBox.Show("Se ha generado un informe en PDF con el nombre \"" + path + "\"" );
        }
示例#9
0
 public ClienteEN(ClienteEN cliente)
 {
     this.init (cliente.Nif, cliente.Nombre, cliente.Descripcion, cliente.Email, cliente.Localidad, cliente.Provincia, cliente.Pais, cliente.Direccion, cliente.CodigoPostal, cliente.Telefono, cliente.Instalaciones);
 }
 private void pintarDatosCliente(ClienteEN cliente2)
 {
     textBoxNIF.Text = cliente2.Nif;
     textBoxNombre.Text = cliente2.Nombre;
     textBoxEmail.Text = cliente2.Email;
     textBoxDireccion.Text = cliente2.Direccion;
     textBoxLocalidad.Text = cliente2.Localidad;
     textBoxProvincia.Text = cliente2.Provincia;
     textBoxCP.Text = cliente2.CodigoPostal;
     textBoxPais.Text = cliente2.Pais;
     textBoxTelefono.Text = cliente2.Telefono;
     textBoxDescripcion.Text = cliente2.Descripcion;
 }