private void CommitRegions() { if (_RegionsModified) { List <Domain.Region> removed = _RegionBindList.GetRemoveList(); foreach (Domain.Region rc in removed) { IList ucs = UserEntity.UserRegionList; foreach (UserRegion uc in ucs) { if (uc.RegionID == rc.ID) { ucs.Remove(uc); break; } } } List <Domain.Region> newc = _RegionBindList.GetNewItemList(); foreach (Domain.Region nc in newc) { bool found = false; IList ucs = UserEntity.UserRegionList; for (int i = 0; i < ucs.Count; i++) { UserRegion uc = (UserRegion)ucs[i]; if (uc.RegionID == nc.ID) { found = true; break; } } if (!found) { UserRegion uc = new UserRegion(); uc.User = UserEntity; uc.RegionID = nc.ID; UserEntity.UserRegionList.Add(uc); } } } }
private void CommitStores() { if (_StoresModified) { List <Store> removed = _StoreBindList.GetRemoveList(); foreach (Store rc in removed) { IList ucs = UserEntity.UserStoreList; foreach (UserStore uc in ucs) { if (uc.StoreID == rc.ID) { ucs.Remove(uc); break; } } } List <Store> newc = _StoreBindList.GetNewItemList(); foreach (Store nc in newc) { bool found = false; IList ucs = UserEntity.UserStoreList; for (int i = 0; i < ucs.Count; i++) { UserStore uc = (UserStore)ucs[i]; if (uc.StoreID == nc.ID) { found = true; break; } } if (!found) { UserStore uc = new UserStore(); uc.User = UserEntity; uc.StoreID = nc.ID; UserEntity.UserStoreList.Add(uc); } } } }
private void CommitCountries() { if (_CountriesModified) { List <Domain.Country> removed = _CountryBindList.GetRemoveList(); foreach (Domain.Country rc in removed) { IList ucs = UserEntity.UserCountryList; foreach (UserCountry uc in ucs) { if (uc.CountryID == rc.ID) { ucs.Remove(uc); break; } } } List <Domain.Country> newc = _CountryBindList.GetNewItemList(); foreach (Domain.Country nc in newc) { bool found = false; IList ucs = UserEntity.UserCountryList; for (int i = 0; i < ucs.Count; i++) { UserCountry uc = (UserCountry)ucs[i]; if (uc.CountryID == nc.ID) { found = true; break; } } if (!found) { UserCountry uc = new UserCountry(); uc.User = UserEntity; uc.CountryID = nc.ID; UserEntity.UserCountryList.Add(uc); } } } }