/// <summary> /// 根据条件获取当前用户能查看的所有车辆,参数的两个条件由 AND 组合 /// </summary> /// <param name="strucName">使用单位</param> /// <param name="plateNumOrTerminalCode">车牌号或终端号</param> private StrucVehiclesListModel[] InternalGetVehiclesListByCurrentUserID(string strucName, string plateNumOrTerminalCode) { var map = new Dictionary <string, List <KeyValuePair <string, string> > >(); List <VehiclesTerminalModel> list; if (base.VehicleViewMode) { list = TerminalSettingsBLL.GetDefaultVehiclesList(base.CurrentStrucID, strucName, plateNumOrTerminalCode); } else { list = TerminalSettingsBLL.GetVehiclesList(base.CurrentUserID, strucName, plateNumOrTerminalCode); } if (list != null && list.Count != 0) { foreach (var item in list) { var vehicle = new KeyValuePair <string, string>(item.PlateNum, item.TerminalCode); string StrucName = item.StrucName; List <KeyValuePair <string, string> > vehiclesList; if (!map.ContainsKey(StrucName)) { vehiclesList = new List <KeyValuePair <string, string> >(); map.Add(StrucName, vehiclesList); } else { vehiclesList = map[StrucName]; } vehiclesList.Add(vehicle); } } var ret = new StrucVehiclesListModel[map.Values.Count]; var Keys = map.Keys.ToArray(); for (int i = 0; i != Keys.Length; i++) { ret[i] = new StrucVehiclesListModel(); ret[i].CompanyName = Keys[i]; ret[i].Vehicles = map[Keys[i]].ToArray(); } return(ret); }