//------------------------------------------------------------------------------------------------------------------ public static List <Pedido> GetPedidoListForSearch(string whereSql) { if (string.IsNullOrEmpty(whereSql)) { whereSql = "1 = 1"; } List <Pedido> theList = new List <Pedido>(); Pedido theUser = null; PedidoTableAdapter theAdapter = new PedidoTableAdapter(); try { PedidoDS.PedidoDataTable table = theAdapter.GetPedidoForSearch(whereSql); if (table != null && table.Rows.Count > 0) { foreach (PedidoDS.PedidoRow row in table.Rows) { theUser = FillPedidoRecord(row); theList.Add(theUser); } } } catch (Exception q) { log.Error("el error ocurrio mientras obtenia la lista de los pedido de la base de datos", q); return(null); } return(theList); }
public static Pedido GetPedidoById(int PedidoID) { PedidoTableAdapter localAdapter = new PedidoTableAdapter(); if (PedidoID <= 0) { return(null); } Pedido theUser = null; try { PedidoDS.PedidoDataTable table = localAdapter.GetPedidoById(PedidoID); if (table != null && table.Rows.Count > 0) { PedidoDS.PedidoRow row = table[0]; theUser = FillPedidoRecord(row); } } catch (Exception q) { log.Error("An error was ocurred while geting Pedido data", q); return(null); } return(theUser); }
//------------------------------------------paginacion----------------------------------------------------- public static int SearchProductoPaginacion(ref List <Pedido> articulos, string where, int pageSize, int firstRow, string ordenar) { try { int?totalRows = 0; PedidoTableAdapter localAdapter = new PedidoTableAdapter(); PedidoDS.PedidoDataTable theTable = localAdapter.searchPedidoBusqueda(where, pageSize, firstRow, ref totalRows, ordenar); if (theTable != null && theTable.Rows.Count > 0) { foreach (PedidoDS.PedidoRow row in theTable.Rows) { articulos.Add(FillPedidoRecord(row)); } } return((int)totalRows); } catch (Exception ex) { throw ex; } }