예제 #1
0
        public void QuitarInmueble(int p_Vista_OID, System.Collections.Generic.IList <int> p_inmueble_OIDs)
        {
            try
            {
                SesssionInitializeTransaction();
                PersonalHomeGenNHibernate.EN.PersonalHome.VistaEN vistaEN = null;
                vistaEN = (VistaEN)session.Load(typeof(VistaEN), p_Vista_OID);

                EN.PersonalHome.InmuebleEN inmuebleEN = null;
                if (vistaEN.Inmueble != null)
                {
                    foreach (int item in p_inmueble_OIDs)
                    {
                        inmuebleEN = (InmuebleEN)session.Load(typeof(InmuebleEN), item);
                        if (vistaEN.Inmueble.Contains(inmuebleEN) == true)
                        {
                            vistaEN.Inmueble.Remove(inmuebleEN);
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_inmueble_OIDs you are trying to unrelationer, doesn't exist in VistaEN");
                        }
                    }
                }

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

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


            finally
            {
                SessionClose();
            }
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            VistaEN t = obj as VistaEN;

            if (t == null)
            {
                return(false);
            }
            if (IdVista.Equals(t.IdVista))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
        public void AsignarVista(int p_Inmueble_OID, System.Collections.Generic.IList <int> p_vista_OIDs)
        {
            PersonalHomeGenNHibernate.EN.PersonalHome.InmuebleEN inmuebleEN = null;
            try
            {
                SesssionInitializeTransaction();
                inmuebleEN = (InmuebleEN)session.Load(typeof(InmuebleEN), p_Inmueble_OID);
                PersonalHomeGenNHibernate.EN.PersonalHome.VistaEN vistaEN = null;
                if (inmuebleEN.Vista == null)
                {
                    inmuebleEN.Vista = new System.Collections.Generic.List <EN.PersonalHome.VistaEN>();
                }

                foreach (int item in p_vista_OIDs)
                {
                    vistaEN = new EN.PersonalHome.VistaEN();
                    vistaEN = (EN.PersonalHome.VistaEN)session.Load(typeof(EN.PersonalHome.VistaEN), item);
                    inmuebleEN.Vista.Add(vistaEN);
                }


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

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


            finally
            {
                SessionClose();
            }
        }
예제 #4
0
 public VistaEN(VistaEN vista)
 {
     this.init(vista.IdVista, vista.Nombre, vista.Estancia, vista.Inmueble);
 }