private void LoadHouseholds() { Households.Clear(); var households = _repository.Household.GetRange(c => c.PurokNo == Model.PurokNo); foreach (var household in households) { Households.Add(new HouseholdModel(household, _repository)); } }
private void newHouseholdCommand_Execute() { var household = new Household(); household.HeadOfHouse = HeadOfHouse; household.Spouse = Spouse; //repo.AddHousehold(household); Households.Add(household); }
/// <summary> /// 读取户数据 /// </summary> private bool ReadHouseholdInformation() { SetSheetIndex(3); string information = ""; object[,] allItem = GetAllRangeValue();//获取所有使用域值 if (allItem == null) { information = tableName + "表中无数据!"; ErrorMsg.Add(information); return(false); } colCount = GetRangeColumnCount(); int columnCount = GetColumnValue("BA"); bool canContinue = colCount >= columnCount; if (!canContinue) { allItem = null; GC.Collect(); information = tableName + "中" + GetWorkSheetName(3) + "工作表格式不正确!"; ErrorMsg.Add(information); return(false); } rowCount = GetRangeRowCount(); int calIndex = 1; for (int index = calIndex; index < rowCount; index++) { string rowValue = GetString(allItem[index, 0]);//编号栏数据 if (string.IsNullOrWhiteSpace(rowValue) || rowValue.Trim() == "合计" || rowValue.Trim() == "总计" || rowValue.Trim() == "共计") { break; } var h = InitalizeHouseholdValue(index, allItem); Households.Add(h); } allItem = null; GC.Collect(); return(true); }
public HouseholdOptions GetHouseOptions(Household house) { if (house == null) { return(null); } else { HouseholdOptions options; if (!Households.TryGetValue(house.HouseholdId, out options)) { options = new HouseholdOptions(house); mHouseholdOptions.Add(options); Households.Add(house.HouseholdId, options); } return(options); } }