Beispiel #1
0
        public int EditConjunto(Conjuntos c)
        {
            int res = 0;

            if (c != null)
            {
                //SE CREA UN DATATABLE COMUN Y SE ASIGNA
                //EL RESULTADO DE UNA CONSULTA LINQ
                //CON EL ID DE LA FILA
                DataTable dt = cta.GetData().
                               Where(x => x.Id == c.id).CopyToDataTable <conjuntosRow>();

                //SE CREA UN DATATABLE TIPO DE LA TABLA
                conjuntosDataTable cdt = new conjuntosDataTable();
                //SE COMBINA LOS DATATABLES PARA FACILITAR EL MANEJO
                cdt.Merge(dt);

                //SE CREA UN DATAROW DEL TIPO DE LA TABLA
                EwoDatabaseDataSet.conjuntosRow conRow =
                    cdt.FindById(c.id);

                //SE ASIGNAN LOS VALORES MODIFICADOS
                conRow.nombre     = c.nombre;
                conRow.image_path = c.image_path;
                conRow.id_sistema = c.id_sistema;

                //SE EJECUTA LA ACTUALIZACIÓN
                res = cta.Update(conRow);
            }

            return(res);
        }
Beispiel #2
0
        public List <Conjuntos> ConsultarConjuntos(int id_sistema)
        {
            List <Conjuntos>   list = new List <Conjuntos>();
            conjuntosDataTable cdt  = new conjuntosDataTable();

            cdt = cta.GetDataByIdSistema(id_sistema);

            for (int i = 0; i < cdt.Rows.Count; i++)
            {
                list.Add(new Conjuntos()
                {
                    id         = int.Parse(cdt.Rows[i][0].ToString()),
                    nombre     = cdt.Rows[i][1].ToString(),
                    id_sistema = int.Parse(cdt.Rows[i][3].ToString()),
                    image_path = cdt.Rows[i][2].ToString()
                });
            }

            return(list);
        }