本文整理汇总了C#中WMS.CustomClass.QueryBuilder.QueryForLocationTableSegerationForLinq方法的典型用法代码示例。如果您正苦于以下问题:C# QueryBuilder.QueryForLocationTableSegerationForLinq方法的具体用法?C# QueryBuilder.QueryForLocationTableSegerationForLinq怎么用?C# QueryBuilder.QueryForLocationTableSegerationForLinq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMS.CustomClass.QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder.QueryForLocationTableSegerationForLinq方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
//
// GET: /AttProcessors/Create
public ActionResult Create()
{
TAS2013Entities db = new TAS2013Entities();
User LoggedInUser = Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
String query = qb.QueryForCompanyViewLinq(LoggedInUser);
ViewBag.PeriodTag = new SelectList(new List<SelectListItem>
{
new SelectListItem { Selected = true, Text = "Daily", Value = "D"},
new SelectListItem { Selected = false, Text = "Monthly", Value = "M"},
new SelectListItem { Selected = false, Text = "Summary", Value = "S"},
}, "Value" , "Text",1);
ViewBag.CriteriaID = new SelectList(new List<SelectListItem>
{
new SelectListItem { Selected = true, Text = "Company", Value = "C"},
new SelectListItem { Selected = false, Text = "Location", Value = "L"},
}, "Value", "Text", 1);
ViewBag.ProcessCats = new SelectList(new List<SelectListItem>
{
new SelectListItem { Selected = true, Text = "Yes", Value = "1"},
new SelectListItem { Selected = false, Text = "No", Value = "0"},
}, "Value", "Text", 1);
ViewBag.CompanyID = new SelectList(db.Companies.Where(query).OrderBy(s=>s.CompName), "CompID", "CompName");
query = qb.QueryForLocationTableSegerationForLinq(LoggedInUser);
ViewBag.LocationID = new SelectList(db.Locations.Where(query).OrderBy(s=>s.LocName), "LocID", "LocName");
ViewBag.CatID = new SelectList(db.Categories.OrderBy(s=>s.CatName), "CatID", "CatName");
return View();
}
示例2: Create
public ActionResult Create()
{
ViewBag.DayOff1 = new SelectList(db.DaysNames.OrderBy(s=>s.Name), "ID", "Name");
ViewBag.DayOff2 = new SelectList(db.DaysNames.OrderBy(s=>s.Name), "ID", "Name");
QueryBuilder qb = new QueryBuilder();
User LoggedInUser = Session["LoggedUser"] as User;
string query = qb.QueryForLocationTableSegerationForLinq(LoggedInUser);
ViewBag.LocationID = new SelectList(db.Locations.Where(query).OrderBy(s=>s.LocName), "LocID", "LocName");
ViewBag.RosterType = new SelectList(db.RosterTypes.OrderBy(s=>s.Name), "ID", "Name");
return View();
}
示例3: BindGridViewLocation
private void BindGridViewLocation(string search)
{
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.QueryForLocationTableSegerationForLinq(LoggedInUser);
List<Location> _View = da.Locations.Where(query).ToList();
GridViewLocation.DataSource = _View.Where(aa => aa.LocName.ToUpper().Contains(search.ToUpper())).ToList();
GridViewLocation.DataBind();
}
示例4: Index
// GET: /Location/
public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
{
if (Session["LogedUserFullname"].ToString() != "")
{
ViewBag.CurrentSort = sortOrder;
ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
//ViewBag.SiteSortParm = sortOrder == "site" ? "site_desc" : "site";
ViewBag.CitySortParm = sortOrder == "city" ? "city_desc" : "city";
ViewBag.RegionSortParm = sortOrder == "region" ? "region_desc" : "region";
if (searchString != null)
{
page = 1;
}
else
{
searchString = currentFilter;
}
ViewBag.CurrentFilter = searchString;
User LoggedInUser = Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.QueryForLocationTableSegerationForLinq(LoggedInUser);
// var locations = qb.GetUserLocationsLinq(locations, LoggedInUser);
var locations = db.Locations.Where(query);
locations = locations.Include(l => l.City).Include(l => l.City.Region);
//
// var locations = dt.ToList<DerivedLocation>();
// var locations = db.Locations.Include(l => l.City).Include(l => l.City.Region);
// String searchParameter = "SELECT [Extent1].[LocID] AS [LocID],[Extent1].[LocName] AS [LocName], [Extent1].[CityID] AS [CityID] FROM [dbo].[Location] AS [Extent1] LEFT OUTER JOIN [dbo].[City] AS [Extent2] ON [Extent1].[CityID] = [Extent2].[CityID] LEFT OUTER JOIN [dbo].[Region] AS [Extent3] ON [Extent2].[RegionID] = [Extent3].[RegionID] WHERE (( CAST(CHARINDEX(UPPER(N"+searchString+"), UPPER([Extent1].[LocName])) AS int)) > 0) OR (( CAST(CHARINDEX(UPPER(N"+searchString+"), UPPER([Extent2].[CityName])) AS int)) > 0) OR (( CAST(CHARINDEX(UPPER(N" + searchString + "), UPPER([Extent3].[RegionName])) AS int)) > 0) ";
if (!String.IsNullOrEmpty(searchString))
{
locations = locations.Where(s => s.LocName.ToUpper().Contains(searchString.ToUpper())
|| s.City.CityName.ToUpper().Contains(searchString.ToUpper())
|| s.City.Region.RegionName.ToUpper().Contains(searchString.ToUpper()));
}
//
switch (sortOrder)
{
case "name_desc":
locations = locations.OrderByDescending(s => s.LocName);
break;
//case "site_desc":
// locations = locations.OrderByDescending(s => s.Site.SiteName);
// break;
//case "site":
// locations = locations.OrderBy(s => s.Site.SiteName);
// break;
case "city_desc":
locations = locations.OrderByDescending(s => s.City.CityName);
break;
case "city":
locations = locations.OrderBy(s => s.City.CityName);
break;
case "region_desc":
locations = locations.OrderByDescending(s => s.City.Region.RegionName);
break;
case "region":
locations = locations.OrderBy(s => s.City.Region.RegionName);
break;
default:
locations = locations.OrderBy(s => s.LocName);
break;
}
int pageSize = 8;
int pageNumber = (page ?? 1);
return View(locations.ToPagedList(pageNumber, pageSize));
}
else
return Redirect(Request.UrlReferrer.ToString());
}
示例5: Index
// GET: /City/
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.QueryForLocationTableSegerationForLinq(LoggedInUser);
var locations= db.Locations.Where(query).GroupBy(x => x.CityID).Select(group => group.FirstOrDefault());
List<City> ct = new List<City>();
foreach (var loc in locations)
ct.Add(loc.City);
var cities = ct.AsEnumerable<City>();
if (!String.IsNullOrEmpty(searchString))
{
cities = cities.Where(s => s.CityName.ToUpper().Contains(searchString.ToUpper())
|| s.CityName.ToUpper().Contains(searchString.ToUpper()));
}
switch (sortOrder)
{
case "name_desc":
cities = cities.OrderByDescending(s => s.CityName);
break;
default:
cities = cities.OrderBy(s => s.CityName);
break;
}
int pageSize = 8;
int pageNumber = (page ?? 1);
return View(cities.ToPagedList(pageNumber, pageSize));
//return View(cities.ToList());
}