private void ViewSupplyDetailTab(int id, bool isSupplyItemIncluded) { using (var repository = new SupplyRepository()) { if (id > 0) { IsWork = false; RibbonMode = RibbonMode.Detail; ChangeControlsEnabled(DetailTab.Controls, false, false); var supply = repository.GetSupply(id); IDTextBox.Text = supply.ID.ToString(); DeliveredDatePicker.Value = supply.Delivered; SupplierNameTextBox.Text = supply.SupplierName; DescriptionTextBox.Text = supply.Description; if (isSupplyItemIncluded) { SupplyItemGrid.DataSource = repository.GetSupplyItems(id); IsSupplyItemChanged = false; SupplyItemGrid.Enabled = !supply.IsApproved; } SupplyTabControl.SelectedTab = DetailTab; SupplyItemGrid.ClearSelection(); } else { IsWork = true; RibbonMode = RibbonMode.Edit; ChangeControlsEnabled(DetailTab.Controls, true, true); IDTextBox.Enabled = false; IDTextBox.Text = repository.GetNextSupplyID().ToString(); SupplyTabControl.SelectedTab = DetailTab; } } }