本文整理汇总了C#中WMS.CustomClass.QueryBuilder.QueryForCompanyViewForLinq方法的典型用法代码示例。如果您正苦于以下问题:C# QueryBuilder.QueryForCompanyViewForLinq方法的具体用法?C# QueryBuilder.QueryForCompanyViewForLinq怎么用?C# QueryBuilder.QueryForCompanyViewForLinq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMS.CustomClass.QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder.QueryForCompanyViewForLinq方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
// GET: /Crew/
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 = Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.QueryForCompanyViewForLinq(LoggedInUser);
var crew = db.Crews.AsQueryable();
if (!String.IsNullOrEmpty(searchString))
{
crew = crew.Where(s => s.CrewName.ToUpper().Contains(searchString.ToUpper()));
}
switch (sortOrder)
{
case "name_desc":
crew = crew.OrderByDescending(s => s.CrewName);
break;
default:
crew = crew.OrderBy(s => s.CrewName);
break;
}
int pageSize = 8;
int pageNumber = (page ?? 1);
return View(crew.ToPagedList(pageNumber, pageSize));
}
示例2: Index
// GET: /Section/
public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
{
if (Session["LogedUserFullname"].ToString() != "")
{
ViewBag.CurrentSort = sortOrder;
ViewBag.SectionSortParm = 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.QueryForCompanyViewForLinq(LoggedInUser);
var sections = db.Sections.Where(query).AsQueryable();
if (!String.IsNullOrEmpty(searchString))
{
sections = sections.Where(s => s.SectionName.ToUpper().Contains(searchString.ToUpper())
|| s.Department.DeptName.ToUpper().Contains(searchString.ToUpper())
|| s.Company.CompName.ToUpper().Contains(searchString.ToUpper()));
}
switch (sortOrder)
{
case "name_desc":
sections = sections.OrderByDescending(s => s.SectionName);
break;
default:
sections = sections.OrderBy(s => s.SectionName);
break;
}
int pageSize = 8;
int pageNumber = (page ?? 1);
return View(sections.ToPagedList(pageNumber, pageSize));
}
else
return Redirect(Request.UrlReferrer.ToString());
}
示例3: BindGridViewType
private void BindGridViewType(string search)
{
FiltersModel fm = Session["FiltersModel"] as FiltersModel;
List<ViewEmpType> _View = new List<ViewEmpType>();
List<ViewEmpType> _TempView = new List<ViewEmpType>();
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.QueryForCompanyViewForLinq(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from ViewEmpType where " + query);
_View = dt.ToList<ViewEmpType>();
if (fm.CompanyFilter.Count > 0)
{
foreach (var comp in fm.CompanyFilter)
{
short _compID = Convert.ToInt16(comp.ID);
_TempView.AddRange(_View.Where(aa => aa.CompanyID == _compID).ToList());
}
_View = _TempView.ToList();
}
GridViewType.DataSource = _View.Where(aa => aa.TypeName.ToUpper().Contains(search.ToUpper())).ToList();
GridViewType.DataBind();
}
示例4: Edit
public ActionResult Edit(short? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Department department = db.Departments.Find(id);
if (department == null)
{
return HttpNotFound();
}
User LoggedInUser = Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.QueryForCompanyViewForLinq(LoggedInUser);
string query1 = qb.QueryForCompanyViewLinq(LoggedInUser);
ViewBag.DivID = new SelectList(db.Divisions.Where(query).AsQueryable().OrderBy(s=>s.DivisionName), "DivisionID", "DivisionName", department.DivID);
ViewBag.CompanyID = new SelectList(db.Companies.Where(query1).AsQueryable().OrderBy(s => s.CompName), "CompID", "CompName");
return View(department);
}