public int EditComponente(Componentes 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 = comta.GetData(). Where(x => x.Id == c.id).CopyToDataTable <componentesRow>(); //SE CREA UN DATATABLE TIPO DE LA TABLA componentesDataTable comdt = new componentesDataTable(); //SE COMBINA LOS DATATABLES PARA FACILITAR EL MANEJO comdt.Merge(dt); //SE CREA UN DATAROW DEL TIPO DE LA TABLA EwoDatabaseDataSet.componentesRow comRow = comdt.FindById(c.id); //SE ASIGNAN LOS VALORES MODIFICADOS comRow.Id = c.id; comRow.codigo_fabricante = c.codigo_fabricante; comRow.codigo_sap = c.codigo_sap; comRow.descripcion = c.descripcion; comRow.ubicacion_almacen = c.ubicacion_almacen; comRow.clase = c.clase; comRow.proveedor = c.proveedor; comRow.estrategia_mtto = c.codigo_estrategia_mtto; comRow.id_smp = c.id_smp; comRow.frecuencia_pm = c.frecuencia_pm; comRow.tipo_frecuencia_pm = c.tipo_frecuencia_pm; comRow.duracion_estandar = c.duracion_estandar; comRow.estado_equipo = c.estado_equipo; comRow.estandar_am = c.estandar_am; comRow.frecuencia_am = c.frecuencia_am; comRow.tipo_frecuencia_am = c.tipo_frecuencia_am; comRow.n_matriz_qp = c.n_matriz_qp; comRow.n_matriz_qm = c.n_matriz_qm; comRow.tipo_kaizen = c.tipo_kaizen; comRow.n_kaizen = c.n_kaizen; comRow.image_path = c.image_path; comRow.id_conjunto = c.id_conjunto; //SE EJECUTA LA ACTUALIZACIÓN res = comta.Update(comRow); } return(res); }
public List <Componentes> ConsultarComponentes(int id_conjunto) { List <Componentes> list = new List <Componentes>(); componentesDataTable cdt = new componentesDataTable(); cdt = comta.GetDataByIdConjunto(id_conjunto); for (int i = 0; i < cdt.Rows.Count; i++) { list.Add(new Componentes() { id = int.Parse(cdt.Rows[i]["Id"].ToString()), codigo_fabricante = cdt.Rows[i]["codigo_fabricante"].ToString(), codigo_sap = cdt.Rows[i]["codigo_sap"].ToString(), descripcion = cdt.Rows[i]["descripcion"].ToString(), ubicacion_almacen = cdt.Rows[i]["ubicacion_almacen"].ToString(), clase = cdt.Rows[i]["clase"].ToString(), proveedor = cdt.Rows[i]["proveedor"].ToString(), codigo_estrategia_mtto = int.Parse(cdt.Rows[i]["estrategia_mtto"].ToString()), id_smp = int.Parse(cdt.Rows[i]["id_smp"].ToString()), frecuencia_pm = int.Parse(cdt.Rows[i]["frecuencia_pm"].ToString()), tipo_frecuencia_pm = int.Parse(cdt.Rows[i]["tipo_frecuencia_pm"].ToString()), duracion_estandar = int.Parse(cdt.Rows[i]["duracion_estandar"].ToString()), estado_equipo = int.Parse(cdt.Rows[i]["estado_equipo"].ToString()), estandar_am = int.Parse(cdt.Rows[i]["estandar_am"].ToString()), frecuencia_am = int.Parse(cdt.Rows[i]["frecuencia_am"].ToString()), tipo_frecuencia_am = int.Parse(cdt.Rows[i]["tipo_frecuencia_am"].ToString()), n_matriz_qp = cdt.Rows[i]["n_matriz_qp"].ToString(), n_matriz_qm = cdt.Rows[i]["n_matriz_qm"].ToString(), tipo_kaizen = int.Parse(cdt.Rows[i]["tipo_kaizen"].ToString()), n_kaizen = int.Parse(cdt.Rows[i]["n_kaizen"].ToString()), image_path = cdt.Rows[i]["image_path"].ToString(), id_conjunto = int.Parse(cdt.Rows[i]["id_conjunto"].ToString()), image = new BitmapImage(new Uri(Util.Global.DIRECTORIO_IMAGENES + @"\" + cdt.Rows[i]["image_path"].ToString())), mttos = daoCal.ConsultarCalendario(int.Parse(cdt.Rows[i]["Id"].ToString())) }); } return(list); }