public IPagedList getPagedList(int?index, int pageSize = 40, params object[] param) { try { int pageIndex = index ?? 0; IEnumerable <ChatRepository> list = (IEnumerable <ChatRepository>)ListRepository(param); PagedListObject First = new PagedListObject() { index = pageIndex }; PagedListObject Last = new PagedListObject() { index = pageIndex }; PagedListObject Prior = new PagedListObject() { index = pageIndex }; PagedListObject Next = new PagedListObject() { index = pageIndex }; PagedListObject[] routeValues = { First, Prior, Next, Last }; return(new PagedList <ChatRepository>(list.ToList(), pageIndex, pageSize, routeValues)); } catch (Exception ex) { throw new Exception(PinheiroSereniException.Exception(ex, GetType().FullName, PinheiroSereniException.ErrorType.PaginationError)); } }
public static IEnumerable <SelectListItem> Bind <T>(PinheiroSereniContext pinheiroSereni_db, string selectedValue = "", string header = "", params object[] param) { IDictionary <string, string> dic = new Dictionary <string, string>(); IEnumerable <SelectListItem> entity = new List <SelectListItem>(); IBindDropDownList Instance = (IBindDropDownList)Activator.CreateInstance(typeof(T)); try { entity = (IEnumerable <SelectListItem>)Instance.List(pinheiroSereni_db, param); foreach (SelectListItem e in entity) { dic.Add(e.Value, e.Text); } return(Funcoes.getDropDownList(dic, selectedValue, header)); } catch (Exception ex) { Validate result = new Validate() { Field = "", Message = PinheiroSereniException.Exception(ex, "PinheiroSereni.Dominio.Factory.BindDropDownList", PinheiroSereniException.ErrorType.DropDownListError) }; return(null); } }