public int New_(int p_articulo, Nullable <DateTime> p_tiempo_inicial, Nullable <DateTime> p_tiempo_final, int p_descuento) { OfertaEN ofertaEN = null; int oid; //Initialized OfertaEN ofertaEN = new OfertaEN(); if (p_articulo != -1) { // El argumento p_articulo -> Property articulo es oid = false // Lista de oids id ofertaEN.Articulo = new SMPGenNHibernate.EN.SMP.ArticuloEN(); ofertaEN.Articulo.Id = p_articulo; } ofertaEN.Tiempo_inicial = p_tiempo_inicial; ofertaEN.Tiempo_final = p_tiempo_final; ofertaEN.Descuento = p_descuento; //Call to OfertaCAD oid = _IOfertaCAD.New_(ofertaEN); return(oid); }
// Modify default (Update all attributes of the class) public void ModifyDefault(OfertaEN oferta) { try { SessionInitializeTransaction(); OfertaEN ofertaEN = (OfertaEN)session.Load(typeof(OfertaEN), oferta.Id); ofertaEN.Tiempo_inicial = oferta.Tiempo_inicial; ofertaEN.Tiempo_final = oferta.Tiempo_final; ofertaEN.Descuento = oferta.Descuento; session.Update(ofertaEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is SMPGenNHibernate.Exceptions.ModelException) { throw ex; } throw new SMPGenNHibernate.Exceptions.DataLayerException("Error in OfertaCAD.", ex); } finally { SessionClose(); } }
public OfertaEN ReadOIDDefault(int id ) { OfertaEN ofertaEN = null; try { SessionInitializeTransaction(); ofertaEN = (OfertaEN)session.Get(typeof(OfertaEN), id); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is SMPGenNHibernate.Exceptions.ModelException) { throw ex; } throw new SMPGenNHibernate.Exceptions.DataLayerException("Error in OfertaCAD.", ex); } finally { SessionClose(); } return(ofertaEN); }
public void Destroy(int id ) { try { SessionInitializeTransaction(); OfertaEN ofertaEN = (OfertaEN)session.Load(typeof(OfertaEN), id); session.Delete(ofertaEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is SMPGenNHibernate.Exceptions.ModelException) { throw ex; } throw new SMPGenNHibernate.Exceptions.DataLayerException("Error in OfertaCAD.", ex); } finally { SessionClose(); } }
public int New_(OfertaEN oferta) { try { SessionInitializeTransaction(); if (oferta.Articulo != null) { // Argumento OID y no colección. oferta.Articulo = (SMPGenNHibernate.EN.SMP.ArticuloEN)session.Load(typeof(SMPGenNHibernate.EN.SMP.ArticuloEN), oferta.Articulo.Id); oferta.Articulo.Oferta = oferta; } session.Save(oferta); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is SMPGenNHibernate.Exceptions.ModelException) { throw ex; } throw new SMPGenNHibernate.Exceptions.DataLayerException("Error in OfertaCAD.", ex); } finally { SessionClose(); } return(oferta.Id); }
public OfertaEN ReadOID(int id ) { OfertaEN ofertaEN = null; ofertaEN = _IOfertaCAD.ReadOID(id); return(ofertaEN); }
public void Modify(int p_oferta_OID, Nullable <DateTime> p_tiempo_inicial, Nullable <DateTime> p_tiempo_final, int p_descuento) { OfertaEN ofertaEN = null; //Initialized OfertaEN ofertaEN = new OfertaEN(); ofertaEN.Id = p_oferta_OID; ofertaEN.Tiempo_inicial = p_tiempo_inicial; ofertaEN.Tiempo_final = p_tiempo_final; ofertaEN.Descuento = p_descuento; //Call to OfertaCAD _IOfertaCAD.Modify(ofertaEN); }