public PhoneBookRecordListModel InitializePhoneBookRecordListModel(PhoneBookRecordQueryItem queryItem) { if (queryItem.UnitId == null) throw new ArgumentException("queryItem.UnitId不能为null"); var model = new PhoneBookRecordListModel(); _phoneBookRepository.GetAll(queryItem.UnitId.Value).ToList().ForEach(o => model.PhoneBookRecordSearchModel.PhoneBookOptions.Add(o.Id.ToString(), o.Name)); model.PhoneBookRecords = _phoneBookRecordRepository.Query(queryItem); model.PhoneBookRecordSearchModel.PhoneBookRecordQueryItem = queryItem; return model; }
public SelectedRecordsResponse InitializeSelectedRecordsResponse(SelectePhoneBookRecordModel selectedUsersModel) { var model = new SelectedRecordsResponse(); var queryItem = new PhoneBookRecordQueryItem(); queryItem.Pagination.PageSize = 1000; if (selectedUsersModel.CheckedAllPage) { queryItem.PhoneBookId = selectedUsersModel.WhereOptions.PhoneBookId; queryItem.Name = selectedUsersModel.WhereOptions.Name; queryItem.Mobile = selectedUsersModel.WhereOptions.Mobile; } else { if (!selectedUsersModel.Ids.Any()) return model; queryItem.Ids = selectedUsersModel.Ids; } queryItem.UnitId = selectedUsersModel.UnitId; _phoneBookRecordRepository.Query(queryItem).ToList().ForEach(phoneBookRecord => model.Telnumbers.Add(phoneBookRecord.Mobile)); return model; }
public PhoneBookRecordSearchModel() { PhoneBookRecordQueryItem = new PhoneBookRecordQueryItem(); PhoneBookOptions=new Dictionary<string, string>(); }