Пример #1
0
        public string Crear(string p_id, float p_horas, float p_precioHora, Nullable<DateTime> p_fecha, float p_total, string p_instalacion)
        {
            FacturaEN facturaEN = null;
            string oid;

            //Initialized FacturaEN
            facturaEN = new FacturaEN ();
            facturaEN.Id = p_id;

            facturaEN.Horas = p_horas;

            facturaEN.PrecioHora = p_precioHora;

            facturaEN.Fecha = p_fecha;

            facturaEN.Total = p_total;

            if (p_instalacion != null) {
                facturaEN.Instalacion = new PalmeralGenNHibernate.EN.Default_.InstalacionEN ();
                facturaEN.Instalacion.Id = p_instalacion;
            }

            //Call to FacturaCAD

            oid = _IFacturaCAD.Crear (facturaEN);
            return oid;
        }
Пример #2
0
        public void Editar(FacturaEN factura)
        {
            try
            {
                SessionInitializeTransaction ();
                FacturaEN facturaEN = (FacturaEN)session.Load (typeof(FacturaEN), factura.Id);

                facturaEN.Horas = factura.Horas;

                facturaEN.PrecioHora = factura.PrecioHora;

                facturaEN.Fecha = factura.Fecha;

                facturaEN.Total = factura.Total;

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

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

            finally
            {
                SessionClose ();
            }
        }
Пример #3
0
        public string Crear(FacturaEN factura)
        {
            try
            {
                SessionInitializeTransaction ();
                if (factura.Instalacion != null) {
                        factura.Instalacion = (PalmeralGenNHibernate.EN.Default_.InstalacionEN)session.Load (typeof(PalmeralGenNHibernate.EN.Default_.InstalacionEN), factura.Instalacion.Id);

                        factura.Instalacion.Facturas.Add (factura);
                }

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

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

            finally
            {
                SessionClose ();
            }

            return factura.Id;
        }
Пример #4
0
        public void Editar(string p_oid, float p_horas, float p_precioHora, Nullable<DateTime> p_fecha, float p_total)
        {
            FacturaEN facturaEN = null;

            //Initialized FacturaEN
            facturaEN = new FacturaEN ();
            facturaEN.Id = p_oid;
            facturaEN.Horas = p_horas;
            facturaEN.PrecioHora = p_precioHora;
            facturaEN.Fecha = p_fecha;
            facturaEN.Total = p_total;
            //Call to FacturaCAD

            _IFacturaCAD.Editar (facturaEN);
        }
        public void Relationer_facturas(string p_instalacion, System.Collections.Generic.IList<string> p_factura)
        {
            PalmeralGenNHibernate.EN.Default_.InstalacionEN instalacionEN = null;
            try
            {
                SessionInitializeTransaction ();
                instalacionEN = (InstalacionEN)session.Load (typeof(InstalacionEN), p_instalacion);
                PalmeralGenNHibernate.EN.Default_.FacturaEN facturasENAux = null;
                if (instalacionEN.Facturas == null) {
                        instalacionEN.Facturas = new System.Collections.Generic.List<PalmeralGenNHibernate.EN.Default_.FacturaEN>();
                }

                foreach (string item in p_factura) {
                        facturasENAux = new PalmeralGenNHibernate.EN.Default_.FacturaEN ();
                        facturasENAux = (PalmeralGenNHibernate.EN.Default_.FacturaEN)session.Load (typeof(PalmeralGenNHibernate.EN.Default_.FacturaEN), item);
                        facturasENAux.Instalacion = instalacionEN;

                        instalacionEN.Facturas.Add (facturasENAux);
                }

                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 ();
            }
        }
Пример #6
0
 public FacturaEN(FacturaEN factura)
 {
     this.init (factura.Id, factura.Horas, factura.PrecioHora, factura.Fecha, factura.Total, factura.Instalacion);
 }