private void RefreshUserPhysicalStoreGrid(int userID) { BLL.PhysicalStore phyStores = new PhysicalStore(); phyStores.LoadAll(); BLL.UserPhysicalStore userPhyStore = new UserPhysicalStore(); userPhyStore.LoadAllEntriesByUserID(userID); if (BLL.UserPhysicalStore.DoesItNeedToBeRefreshed(userID)) { BLL.UserPhysicalStore usrPhyStore = new UserPhysicalStore(); usrPhyStore.RenewMatrixForAUser(userID); } if (userPhyStore.RowCount == 0) { BLL.UserPhysicalStore usrPhyStore = new UserPhysicalStore(); usrPhyStore.GenerateMatrixForANewUser(userID); RefreshUserPhysicalStoreGrid(userID); } else if (userPhyStore.RowCount >= phyStores.RowCount) { grdUserPhysicalStoreMatrix.DataSource = userPhyStore.DefaultView; lcUserPhysicalStoreMatrix.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } else { BLL.UserPhysicalStore usrStore = new UserPhysicalStore(); usrStore.RenewMatrixForAUser(userID); RefreshUserPhysicalStoreGrid(userID); } }