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); } }
private void repoItemChkPhysicalStoreDefault_CheckedChanged(object sender, EventArgs e) { DataRow dr = gridViewUserPhysicalStoreMatrix.GetFocusedDataRow(); int ID = int.Parse(dr["ID"].ToString()); BLL.UserPhysicalStore userPhyStore = new UserPhysicalStore(); userPhyStore.LoadByPrimaryKey(ID); userPhyStore.MakeDefault(); RefreshUserPhysicalStoreGrid(userPhyStore.UserID); }