示例#1
0
文件: Helper.cs 项目: gkeary/Console2
 public static CurrentDayRoute GetOneCDR(int? cdrkey)
 {
     // original return  (CurrentDayRoute.All().Where(x => (x.CurrentDayRouteID == cdrkey))).FirstOrDefault();
     var name = "GetOneCDR(int? cdrkey)";
     if (cdrkey.HasValue)
     {
         return (CurrentDayRoute.Find(x => x.CurrentDayRouteID == cdrkey).First());
     }
     else
     {
         CurrentDayRoute cdr = CurrentDayRoute.Find(x => x.CurrentDayRouteID == cdrkey.Value).DefaultIfEmpty(
             new CurrentDayRoute
                 {
                     CDRRouteID = "xx",
                     CDRRouteName = name,
                     DUser = "******",
                     Terminal = "not allowed"
                 }).First();
         return cdr;
     }
 }
示例#2
0
文件: Helper.cs 项目: gkeary/Console2
 public static int GetCDRCount()
 {
     return CurrentDayRoute.All().Count();
 }
示例#3
0
文件: Helper.cs 项目: gkeary/Console2
 public static CurrentDayRoute GetRouteWithKey(int? key)
 {
     var first = CurrentDayRoute.Find(x => x.CurrentDayRouteID == key).FirstOrDefault() ??
                 new CurrentDayRoute { CurrentDayRouteID = 500, CDRDriverLastName = "invalid route" };
     return first;
 }
示例#4
0
文件: Helper.cs 项目: gkeary/Console2
 public static CurrentDayRoute GetCDRWithRouteID(string tag)
 {
     return (from r in CurrentDayRoute.All()
                             where (r.CDRRouteID == tag)
                             select r).FirstOrDefault();
 }