/// <summary> /// 取得里鄰統計 /// </summary> /// <param name="District"></param> /// <param name="Area"></param> /// <returns></returns> public DistrictAreaCounterBase GetDistricAreaCount(string District, string Area) { DistrictAreaCounterBase dacbEntity = new DistrictAreaCounterBase(); foreach (DistrictAreaCounterBase dacb in _DistrictAreaCounterList) { if (dacb.GetDistrict() == District && dacb.GetArea() == Area) { dacbEntity = dacb; break; } } return(dacbEntity); }
/// <summary> /// 計算里鄰人數 /// </summary> /// <param name="StudentEntityList"></param> public List <StudentEntity> CalDistrictAreaCount(List <StudentEntity> _StudentEntityList) { _DistrictAreaCounterList.Clear(); // 比對名稱使用 List <string> tmpCmpName = new List <string>(); foreach (StudentEntity se in _StudentEntityList) { string PermanentDistrict = ""; string PermanentArea = ""; if (se.PermanentDistrict != null) { PermanentDistrict = se.PermanentDistrict.Trim(); } if (se.PermanentArea != null) { PermanentArea = se.PermanentArea.Trim(); } string key = PermanentDistrict + PermanentArea; if (tmpCmpName.Contains(key)) { foreach (DistrictAreaCounterBase sacb in _DistrictAreaCounterList) { if (sacb.GetDistrict() == PermanentDistrict && sacb.GetArea() == PermanentArea) { se.Memo += sacb.AddCount(PermanentDistrict, PermanentArea, se.Gender); } } } else { DistrictAreaCounterBase sacb = new DistrictAreaCounterBase(); sacb.AddCount(PermanentDistrict, PermanentArea, se.Gender); _DistrictAreaCounterList.Add(sacb); } tmpCmpName.Add(key); } return(_StudentEntityList); }