本文整理汇总了C#中WMS.CustomClass.QueryBuilder.QueryForUserAccess方法的典型用法代码示例。如果您正苦于以下问题:C# QueryBuilder.QueryForUserAccess方法的具体用法?C# QueryBuilder.QueryForUserAccess怎么用?C# QueryBuilder.QueryForUserAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMS.CustomClass.QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder.QueryForUserAccess方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
// GET: /LvShort/
public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
{
User LoggedInUser = Session["LoggedUser"] as User;
ViewBag.CurrentSort = sortOrder;
ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
ViewBag.TypeSortParm = sortOrder == "LvType" ? "LvType_desc" : "LvType";
ViewBag.DateSortParm = sortOrder == "Date" ? "Date_desc" : "Date";
if (searchString != null)
{
page = 1;
}
else
{
searchString = currentFilter;
}
QueryBuilder qb = new QueryBuilder();
string query = qb.QueryForUserAccess(LoggedInUser, qb.CheckForUserRole(LoggedInUser));
DateTime dt1 = DateTime.Today;
DateTime dt2 = new DateTime(dt1.Year, 1, 1);
string date = dt2.Year.ToString() + "-" + dt2.Month.ToString() + "-" + dt2.Day.ToString() + " ";
DataTable dt = qb.GetValuesfromDB("select * from ViewSLData where " + query);
List<ViewSLData> lvapplications = dt.ToList<ViewSLData>();
ViewBag.CurrentFilter = searchString;
//var lvapplications = db.LvApplications.Where(aa=>aa.ToDate>=dt2).Include(l => l.Emp).Include(l => l.LvType1);
if (!String.IsNullOrEmpty(searchString))
{
lvapplications = lvapplications.Where(s => s.EmpName.ToUpper().Contains(searchString.ToUpper())
|| s.EmpNo.ToUpper().Contains(searchString.ToUpper())).ToList();
}
switch (sortOrder)
{
case "name_desc":
lvapplications = lvapplications.OrderByDescending(s => s.EmpName).ToList();
break;
case "Date_desc":
lvapplications = lvapplications.OrderByDescending(s => s.DutyDate).ToList();
break;
case "Date":
lvapplications = lvapplications.OrderBy(s => s.DutyDate).ToList();
break;
default:
lvapplications = lvapplications.OrderBy(s => s.EmpName).ToList();
break;
}
int pageSize = 10;
int pageNumber = (page ?? 1);
return View(lvapplications.OrderByDescending(aa => aa.DutyDate).ToPagedList(pageNumber, pageSize));
}
示例2: Index
//
// GET: /Zones/
public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
{
ViewBag.CurrentSort = sortOrder;
ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
if (searchString != null)
{
page = 1;
}
else
{
searchString = currentFilter;
}
ViewBag.CurrentFilter = searchString;
User LoggedInUser = HttpContext.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.QueryForUserAccess(LoggedInUser, "Zone");
DataTable dt = qb.GetValuesfromDB("Select * FROM Zone where " + query);
var zone = dt.ToList<Zone>().AsQueryable();
if (!String.IsNullOrEmpty(searchString))
{
zone = zone.Where(s => s.ZoneName.ToUpper().Contains(searchString.ToUpper()));
}
switch (sortOrder)
{
case "name_desc":
zone = zone.OrderByDescending(s => s.ZoneName);
break;
default:
zone = zone.OrderBy(s => s.ZoneName);
break;
}
int pageSize = 8;
int pageNumber = (page ?? 1);
return View(zone.ToPagedList(pageNumber, pageSize));
}