//------------------------------------------------------------------------------------------------------------------ //--------------------------------------------busqueda where--------------------------------------------------------- public static List <Imagen> GetImagenListForSearch(string whereSql) { if (string.IsNullOrEmpty(whereSql)) { whereSql = "1 = 1"; } List <Imagen> theList = new List <Imagen>(); Imagen theUser = null; ImagenTableAdapter theAdapter = new ImagenTableAdapter(); try { ImagenDS.ImagenDataTable table = theAdapter.GetSearchImagenForWhere(whereSql); if (table != null && table.Rows.Count > 0) { foreach (ImagenDS.ImagenRow row in table.Rows) { theUser = FillImagenRecord(row); theList.Add(theUser); } } } catch (Exception q) { log.Error("el error ocurrio mientras obtenia la lista de los usuarios de la base de datos", q); throw q; //return null; } return(theList); }
//public static Imagen GetProductoById(int Idprocuto) //{ // ImagenTableAdapter localAdapter = new ImagenTableAdapter(); // if (Idprocuto <= 0) // return null; // Imagen theUser = null; // try // { // ImagenDS.ImagenDataTable table = localAdapter.GetImagenById(Idprocuto); // if (table != null && table.Rows.Count > 0) // { // ImagenDS.ImagenRow row = table[0]; // theUser = FillImagenRecord(row); // } // } // catch (Exception q) // { // log.Error("Un error ocurrio mientras obtenia el modulo de la base de dato", q); // return null; // } // return theUser; //} public static Imagen GetImagenById(int IdImagenId) { ImagenTableAdapter localAdapter = new ImagenTableAdapter(); if (IdImagenId <= 0) { return(null); } Imagen theUser = null; try { ImagenDS.ImagenDataTable table = localAdapter.GetImagenById(IdImagenId); if (table != null && table.Rows.Count > 0) { ImagenDS.ImagenRow row = table[0]; theUser = FillImagenRecord(row); } } catch (Exception q) { log.Error("Un error ocurrio mientras obtenia la imagen de la base de dato", q); return(null); } return(theUser); }
//------------------------------------------paginacion----------------------------------------------------- public static int SearchFiles(ref List <Imagen> articulos, string where, int pageSize, int firstRow, string ordenar) { try { int?totalRows = 0; ImagenTableAdapter localAdapter = new ImagenTableAdapter(); ImagenDS.ImagenDataTable theTable = localAdapter.GetSearchForImagen(where, pageSize, firstRow, ref totalRows, ordenar); if (theTable != null && theTable.Rows.Count > 0) { foreach (ImagenDS.ImagenRow row in theTable.Rows) { articulos.Add(FillImagenRecord(row)); } } return((int)totalRows); } catch (Exception ex) { throw ex; } }