private void ComponentForm_VisibleChanged(object sender, EventArgs e) { if (Visible && componentID == -1) { ComponentGrid.ClearSelection(); } }
private void ViewProductDetailTab(int id) { if (id > 0) { IsWork = false; RibbonMode = RibbonMode.Detail; ChangeControlsEnabled(DetailTab.Controls, false, false); var product = ProductRepository.GetProduct(id); IDTextBox.Text = product.ID.ToString(); NameTextBox.Text = product.Name.ToString(); ScaleTextBox.Text = product.Scale.ToString(); ComponentGrid.DataSource = ProductRepository.GetComponents(id); ProductTabControl.SelectedTab = DetailTab; ComponentGrid.ClearSelection(); } else { IsWork = true; RibbonMode = RibbonMode.Edit; ChangeControlsEnabled(DetailTab.Controls, true, true); ProductTabControl.SelectedTab = DetailTab; } }
private void FilterButton_Click(object sender, EventArgs e) { var filter = new ComponentFilter { ComponentTypeID = (FilterComponentTypeDropDown.SelectedValue.AsByte() == 0) ? null : FilterComponentTypeDropDown.SelectedValue.AsByte(), Name = FilterNameTextBox.Text, ProductID = (FilterProductDropDown.SelectedValue.AsInt() == 0) ? null : FilterProductDropDown.SelectedValue.AsInt(), IsNotAssignedOnly = FilterIsNotAssignedOnlyCheckBox.Checked }; ComponentGrid.DataSource = ComponentRepository.GetComponents(filter); ComponentGrid.ClearSelection(); }
private void CancelButton_Click(object sender, EventArgs e) { ComponentErrorProvider.Clear(); if (componentID > 0) { ViewComponentDetailTab(componentID); } else { ViewComponentListingTab(); componentID = -1; ComponentGrid.ClearSelection(); } }
private void InventoryItemPopup_Load(object sender, EventArgs e) { Left = MainForm.Location.X + (MainForm.Width / 2 - Width / 2); Top = MainForm.Location.Y + (MainForm.Height / 2 - Height / 2); using (var repository = new ComponentTypeRepository()) { var dropDown = repository.GetComponentTypeForDropDown(); dropDown.Insert(0, new KeyValuePair <byte, string>()); FilterComponentTypeDropDown.DataSource = dropDown; } using (var repository = new ProductRepository()) { var dropDown = repository.GetProductsForDropDown(inventoryID); dropDown.Insert(0, new KeyValuePair <int, string>()); FilterProductDropDown.DataSource = dropDown; } FilterButton_Click(sender, e); ComponentGrid.ClearSelection(); }