コード例 #1
0
        public bool DesPubicarOferta()
        {
            try
            {
                DALC.QueOfrecesEntities ctx = new DALC.QueOfrecesEntities();
                DALC.OFERTA             of  = ctx.OFERTA.First(o => o.ID_OFERTA == IdOferta && o.ESTADO_OFERTA == "1");

                of.IMAGEN_OFERTA       = this.ImagenOferta;
                of.MIN_PRODUCTO        = this.MinProductos;
                of.MAX_PRODUCTO        = this.MaxProductos;
                of.ESTADO_OFERTA       = "0";
                of.FECHA_OFERTA        = this.FechaOferta;
                of.SUCURSALES_ID       = this.IdSucursal;
                of.CATEGORIA_OFERTA_ID = this.CategoriaIdOferta;
                of.NOMBRE      = this.Nombre;
                of.DESCRIPCION = this.Descripcion;
                of.OFERTA_DIA  = this.OfertaDia.ToString();

                ctx.SaveChanges();
                ctx = null;

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #2
0
        public bool CrearOferta()
        {
            try
            {
                DALC.QueOfrecesEntities ctx = new DALC.QueOfrecesEntities();
                DALC.OFERTA             of  = new DALC.OFERTA();

                of.ID_OFERTA           = this.IdOferta;
                of.IMAGEN_OFERTA       = this.ImagenOferta;
                of.MIN_PRODUCTO        = this.MinProductos;
                of.MAX_PRODUCTO        = this.MaxProductos;
                of.ESTADO_OFERTA       = this.EstadoOferta.ToString();
                of.FECHA_OFERTA        = this.FechaOferta;
                of.PRECIO_DESPUES      = this.PrecioOferta;
                of.PRECIO_ANTES        = this.PrecioAntes;
                of.SUCURSALES_ID       = this.IdSucursal;
                of.CATEGORIA_OFERTA_ID = this.CategoriaIdOferta;
                of.NOMBRE      = this.Nombre;
                of.DESCRIPCION = this.Descripcion;
                of.OFERTA_DIA  = this.EstadoOferta.ToString();

                ctx.OFERTA.Add(of);
                ctx.SaveChanges();
                ctx = null;

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #3
0
        public bool EliminarOferta()
        {
            try
            {
                DALC.QueOfrecesEntities ctx = new DALC.QueOfrecesEntities();
                DALC.OFERTA             of  = ctx.OFERTA.First(o => o.ID_OFERTA == IdOferta);

                ctx.Entry(of).State = System.Data.EntityState.Deleted;
                ctx.SaveChanges();
                ctx = null;
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }