public ActionResult HCommand(GLAspectsandElements conta, int?page, string ipp, string refresh, string promote, string up, string down, string demote) { hidServices <GLAspectsandElements> hs = new hidServices <GLAspectsandElements>(db); if (string.IsNullOrEmpty(refresh)) { var pk = Session["itemSelecionado"] as String; try { if (!string.IsNullOrEmpty(promote)) { hs.Command(pk, hidServices <GLAspectsandElements> .Commands.Promote); } if (!string.IsNullOrEmpty(up)) { hs.Command(pk, hidServices <GLAspectsandElements> .Commands.Up); } if (!string.IsNullOrEmpty(down)) { hs.Command(pk, hidServices <GLAspectsandElements> .Commands.Down); } if (!string.IsNullOrEmpty(demote)) { hs.Command(pk, hidServices <GLAspectsandElements> .Commands.Demote); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } } ArrayList recolhidas = (ArrayList)Session["ContasCollapsedList"]; db = new GLaccountsModel(); // to refresh entity after sql command string wc = hs.WhereClause(recolhidas); var result = db.Database.SqlQuery <GLAspectsandElements>("select * from GLAspectsandElements where " + wc + " order by hid").ToList(); // Sql server only //var result = db.GLaccounts.OrderBy(c => c.hid).ToList().Where(c => c.IsNotCollapsed(hs, recolhidas)); int pageNumber = page ?? 1; ipp = ipp ?? (string)Session["DefaultItemsPerPage"]; return(View("Index", result.ToPagedList(pageNumber, int.Parse(ipp)))); }
public ActionResult HCommand(GLaccounts conta, int?page, string ipp, string refresh, string promote, string up, string down, string demote) { hidServices <GLaccounts> hs = new hidServices <GLaccounts>(db); if (string.IsNullOrEmpty(refresh)) { var pk = Session["itemSelecionado"] as String; try { if (!string.IsNullOrEmpty(promote)) { hs.Command(pk, hidServices <GLaccounts> .Commands.Promote); } if (!string.IsNullOrEmpty(up)) { hs.Command(pk, hidServices <GLaccounts> .Commands.Up); } if (!string.IsNullOrEmpty(down)) { hs.Command(pk, hidServices <GLaccounts> .Commands.Down); } if (!string.IsNullOrEmpty(demote)) { hs.Command(pk, hidServices <GLaccounts> .Commands.Demote); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } } ArrayList recolhidas = (ArrayList)Session["ContasCollapsedList"]; var result = db.GLaccounts.OrderBy(c => c.hid).ToList().Where(c => c.IsNotCollapsed(hs, recolhidas)); int pageNumber = page ?? 1; ipp = ipp ?? (string)Session["DefaultItemsPerPage"]; return(View("Index", result.ToPagedList(pageNumber, int.Parse(ipp)))); }