Ejemplo n.º 1
0
        /// <summary>
        /// Actualiza un registro de producto en la BBDD
        /// </summary>
        /// <returns></returns>
        public bool Update()
        {
            Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities();

            try
            {
                /* Se obtiene el primer registro coincidente con el id */
                Datos.COMUNA com = bbdd.COMUNA.First(e => e.ID_COMUNA == ID_COMUNA);

                /* Se copian las propiedades del negocio a los datos */
                CommonBC.Syncronize(this, com);

                bbdd.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        //Agregar
        public bool Create()
        {
            Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities();

            Datos.COMUNA com = new Datos.COMUNA();

            try
            {
                CommonBC.Syncronize(this, com);

                bbdd.COMUNA.Add(com);
                bbdd.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                bbdd.COMUNA.Remove(com);
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Elimina un registro de producto en la BBDD
        /// </summary>
        /// <returns></returns>
        public bool Delete()
        {
            Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities();

            try
            {
                /* Se obtiene el primer registro coincidente con el id */
                Datos.COMUNA com = bbdd.COMUNA.First(e => e.ID_COMUNA == ID_COMUNA);

                /* Se elimina el registro del EDM */
                bbdd.COMUNA.Remove(com);

                bbdd.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Lee un registro de producto en la BBDD
        /// </summary>
        /// <returns></returns>
        public bool Read()
        {
            Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities();

            try
            {
                /* Se obtiene el primer registro coincidente con el id */
                Datos.COMUNA com = bbdd.COMUNA.First(e => e.ID_COMUNA == ID_COMUNA);

                /* Se copian las propiedades de datos al negocio */
                CommonBC.Syncronize(com, this);

                /* Carga descripción de los Tipos */
                LeerNombreRegion();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }