public void QueryClassroomBuildings() { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("sWhere", string.Format( "{0} \"BuildingName\":\"{1}\",\"Location\":\"{2}\"{3}" , "{", BuildingName, Location, "}")); int total = 0; try { Collection <ClassroomBuilding> classroomBuildings = restConnection.GetPageValues <ClassroomBuilding>("api/ClassroomBuilding/QueryClassroomBuildingsIncludeClassRooms" , 1, 0, 1000000, parameters, ref total); if (null != classroomBuildings) { Items.Clear(); foreach (var classroomBuilding in classroomBuildings) { Items.Add(classroomBuilding); } } } catch (Exception e) { RadWindow.Alert(new DialogParameters { OkButtonContent = "确定", Content = e.Message, Owner = App.Current.MainWindow, Header = "错误" }); } }
public void QueryClassrooms() { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("sWhere", string.Format( "{0} \"RoomNum\":\"{1}\",\"BuildingId\":\"{2}\", \"TerminalId\":\"{3}\",\"TerminalIp\":\"{4}\",\"IdentifyMode\":\"{5}\"{6}" , "{", RoomNum, BuildingId, TerminalId, TerminalIp, IdentifyMode, "}")); int total = 0; try { Collection <ClassRoom> classrooms = restConnection.GetPageValues <ClassRoom>("api/ClassRoomInfoMaint/QueryClassRooms" , 1, 0, 1000000, parameters, ref total); if (null != classrooms) { Items.Clear(); foreach (var classroom in classrooms) { //使classroom中的ClassroomBuilding与ClassroomBuildings集合中的对象为同一对象 //解决在下拉列表框中无法选中Id相同对象的问题 classroom.ClassroomBuilding = ClassroomBuildings.Where(p => p.Id == classroom.ClassroomBuilding.Id).FirstOrDefault(); Items.Add(classroom); } } } catch (Exception e) { RadWindow.Alert(new DialogParameters { OkButtonContent = "确定", Content = e.Message, Owner = App.Current.MainWindow, Header = "错误" }); } }