예제 #1
0
        public bool Update(Cenas cenas)
        {
            OnBreakDBEntities db = new OnBreakDBEntities();

            try
            {
                Datos.Cenas c = (from cb in db.Cenas
                                 where cb.Numero == cenas.Contrato.Numero
                                 select cb).FirstOrDefault();

                c.Numero             = cenas.Contrato.Numero;
                c.LocalOnBreak       = cenas.LocalOnBreak;
                c.MusicaAmbiental    = cenas.MusicaAmbiental;
                c.OtroLocalOnBreak   = cenas.OtroLocalOnBreak;
                c.ValorArriendo      = cenas.ValorArriendo;
                c.IdTipoAmbientacion = cenas.TipoAmbientacion.Id;

                db.Entry(c).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #2
0
        public bool Create()
        {
            try
            {
                this.Number = SetID();
                CreateContract();

                Datos.Cenas cena = new Datos.Cenas()
                {
                    Numero             = this.Number,
                    IdTipoAmbientacion = this.IdTipoAmbientacion,
                    MusicaAmbiental    = this.MusicaAmbiental,
                    LocalOnBreak       = this.LocalOnBreak,
                    OtroLocalOnBreak   = this.OtroLocalOnBreak,
                    ValorArriendo      = this.ValorArriendo
                };

                Conexion.OnBreakBD.Entry(cena).State = EntityState.Added;
                Conexion.OnBreakBD.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
예제 #3
0
 public bool Delete()
 {
     Datos.OnBreakEntities bbdd = new Datos.OnBreakEntities();
     try
     {
         Datos.Cenas ce = bbdd.Cenas.First(c => c.Numero == Numero);
         bbdd.Cenas.Remove(ce);
         bbdd.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #4
0
 public bool Update()
 {
     Datos.OnBreakEntities bbdd = new Datos.OnBreakEntities();
     try
     {
         Datos.Cenas ce = bbdd.Cenas.First(c => c.Numero == Numero);
         CommonBC.Syncronize(this, ce);
         bbdd.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #5
0
        public bool Read()
        {
            Datos.OnBreakEntities bbdd = new Datos.OnBreakEntities();

            try
            {
                Datos.Cenas ce = bbdd.Cenas.First(c => c.Numero == Numero);
                CommonBC.Syncronize(ce, this);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #6
0
 public bool Create()
 {
     try
     {
         Datos.OnBreakEntities context = new Datos.OnBreakEntities();
         Datos.Cenas           cenas   = new Datos.Cenas();
         CommonBC.Syncronize(this, cenas);
         context.Cenas.Add(cenas);
         context.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #7
0
 public bool Create()
 {
     Datos.OnBreakEntities bbdd = new Datos.OnBreakEntities();
     Datos.Cenas           ce   = new Datos.Cenas();
     try
     {
         CommonBC.Syncronize(this, ce);
         bbdd.Cenas.Add(ce);
         bbdd.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         bbdd.Cenas.Remove(ce);
         return(false);
     }
 }
예제 #8
0
        public bool Read()
        {
            try
            {
                ReadContract();
                Datos.Cenas cen = (from auxpaa in Conexion.OnBreakBD.Cenas
                                   where auxpaa.Numero == this.Number
                                   select auxpaa).First();

                this.IdTipoAmbientacion = cen.IdTipoAmbientacion;
                this.MusicaAmbiental    = cen.MusicaAmbiental;
                this.LocalOnBreak       = cen.LocalOnBreak;
                this.OtroLocalOnBreak   = cen.OtroLocalOnBreak;
                this.ValorArriendo      = cen.ValorArriendo;

                return(true);
            }
            catch
            {
                return(false);
            }
        }
예제 #9
0
        public bool Create(Cenas cenas)
        {
            OnBreakDBEntities db   = new OnBreakDBEntities();
            Cenas             cena = new Cenas();

            try
            {
                Datos.Cenas c = new Datos.Cenas();
                c.Numero             = cenas.Contrato.Numero;
                c.LocalOnBreak       = cenas.LocalOnBreak;
                c.MusicaAmbiental    = cenas.MusicaAmbiental;
                c.OtroLocalOnBreak   = cenas.OtroLocalOnBreak;
                c.ValorArriendo      = cenas.ValorArriendo;
                c.IdTipoAmbientacion = cenas.TipoAmbientacion.Id;

                db.Cenas.Add(c);
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }