Пример #1
0
        public List <Entities.CategoriaConfiguracion> ListarCategoriaConfiguracion(InglesIndividual.Entities.JQXGridSettings settings, string nomCategoria)
        {
            List <Entities.CategoriaConfiguracion> list = new List <Entities.CategoriaConfiguracion>();

            DataEntities.SpCategoriaConfiguracionGrd sp = new DataEntities.SpCategoriaConfiguracionGrd();
            sp.NomCategoria = nomCategoria;

            this.ConfigurePagedStoredProcedure(sp, settings);

            DataTable dt = sp.GetDataTable(this.ConnectionString);

            foreach (DataRow dr in dt.Rows)
            {
                Entities.CategoriaConfiguracion item = new Entities.CategoriaConfiguracion(true);

                item.ClaCategoria = Utils.GetDataRowValue(dr, "ClaCategoria", 0);
                item.Nombre       = Utils.GetDataRowValue(dr, "NomCategoria", "");


                this.SetWebEntityGridValues(item, dr);

                list.Add(item);
            }

            return(list);
        }
Пример #2
0
        public override int Update(Entity entity)
        {
            Entities.CategoriaConfiguracion          item = entity as Entities.CategoriaConfiguracion;
            DataEntities.SpCategoriaConfiguracionUpd sp   = new DataEntities.SpCategoriaConfiguracionUpd();
            sp.ClaCategoria = item.ClaCategoria;
            sp.NomCategoria = item.Nombre;

            return(sp.ExecuteNonQuery(this.ConnectionString));
        }
Пример #3
0
        public override void PrepareEntityForEdition(Entity entity)
        {
            Entities.CategoriaConfiguracion item = entity as Entities.CategoriaConfiguracion;
            if (item != null && item.FromDataSource)
            {
                DataEntities.SpCategoriaConfiguracionSel sp = new DataEntities.SpCategoriaConfiguracionSel();
                sp.ClaCategoria = item.ClaCategoria;

                DataTable dt = sp.GetDataTable(this.ConnectionString);
                if (dt != null && dt.Rows.Count == 1)
                {
                    item.ClaCategoria = Utils.GetDataRowValue(dt.Rows[0], "ClaCategoria", 0);
                    item.Nombre       = Utils.GetDataRowValue(dt.Rows[0], "NomCategoria", "");
                }
            }
        }
Пример #4
0
        public override int Delete(Entity entity, DataTransaction tran)
        {
            Entities.CategoriaConfiguracion item = entity as Entities.CategoriaConfiguracion;
            DataEntities.SpCategoriaConfiguracionDel
                sp = new DataEntities.SpCategoriaConfiguracionDel();
            sp.ClaCategoria = item.ClaCategoria;

            if (tran != null)
            {
                return(sp.ExecuteNonQuery(tran));
            }
            else
            {
                return(sp.ExecuteNonQuery(this.ConnectionString));
            }
        }
Пример #5
0
        public override int Insert(Entity entity, DataTransaction tran)
        {
            Entities.CategoriaConfiguracion item = entity as Entities.CategoriaConfiguracion;
            DataEntities.SpCategoriaConfiguracionIns
                sp = new DataEntities.SpCategoriaConfiguracionIns();
            sp.ClaCategoria = item.ClaCategoria;
            sp.NomCategoria = item.Nombre;


            //  if (tran != null)
            //  {
            //     return sp.ExecuteNonQuery(tran);

            // }
            // else
            // {
            return(sp.ExecuteNonQuery(this.ConnectionString));
            // }
        }
        public List <Exception> Eliminar(string[] ids)
        {
            List <Exception> list = new List <Exception>();

            if (ids != null && ids.Length > 0)
            {
                foreach (string id in ids)
                {
                    Entities.CategoriaConfiguracion item = new Entities.CategoriaConfiguracion(true);
                    item.ClaCategoria = Utils.IsNull(id, 0);

                    try
                    {
                        this.Data.Delete(item);
                    }
                    catch (Exception ex)
                    {
                        list.Add(ex);
                    }
                }
            }

            return(list);
        }