Exemplo n.º 1
0
        public PasoaPaso ConsultarPasoByPasoDesc(string paso, string desc)
        {
            PasoaPaso          pp  = new PasoaPaso();
            smp_pasosDataTable pdt = null;

            pdt = sta.GetDataByPasoDesc(paso, desc);

            if (pdt.Rows.Count > 0)
            {
                pp.Id = int.Parse(pdt.Rows[0]["Id"].ToString());
            }

            return(pp);
        }
Exemplo n.º 2
0
        public int EditPaso(PasoaPaso pp)
        {
            int res = 0;

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

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

                //SE CREA UN DATAROW DEL TIPO DE LA TABLA
                EwoDatabaseDataSet.smp_pasosRow pasRow =
                    pdt.FindById(pp.Id);

                int id_cat = int.Parse(tdta.GetDataByDesc
                                           (pp.categoria).Rows[0]["Id"].ToString());

                //SE ASIGNAN LOS VALORES MODIFICADOS
                //pasRow.image_path = Path.GetFileName(pp.imagen_paso_path);
                //pasRow.paso = pp.paso;
                //pasRow.descripcion = pp.desc;
                //pasRow.duracion = int.Parse(pp.duracion);
                //pasRow.categoria_id = id_cat;
                pasRow.id_smp = pp.id_smp;

                //SE EJECUTA LA ACTUALIZACIÓN
                res = sta.Update(pasRow);
            }

            return(res);
        }