private void InventoryForm_VisibleChanged(object sender, EventArgs e) { if (Visible && inventoryID == -1) { InventoryGrid.ClearSelection(); } }
private void CancelButton_Click(object sender, EventArgs e) { InventoryErrorProvider.Clear(); if (inventoryID > 0) { ViewInventoryDetailTab(inventoryID, false); } else { ViewInventoryListingTab(); inventoryID = -1; InventoryGrid.ClearSelection(); } }
private void FilterButton_Click(object sender, EventArgs e) { var filter = new InventoryFilter { ID = FilterIDTextBox.Text.AsInt(), ComponentID = (FilterComponentDropDown.SelectedValue.AsInt() == 0) ? null : FilterComponentDropDown.SelectedValue.AsInt(), EnteredFrom = (FilterEnteredFromDatePicker.Format == DateTimePickerFormat.Custom) ? null : FilterEnteredFromDatePicker.Value.Date.AsDateTime(), EnteredTo = (FilterEnteredToDatePicker.Format == DateTimePickerFormat.Custom) ? null : FilterEnteredToDatePicker.Value.Date.AsDateTime(), IsNotApprovedOnly = FilterIsNotApprovedOnlyCheckBox.Checked }; using (var repository = new InventoryRepository()) { InventoryGrid.DataSource = repository.GetInventories(filter); } InventoryGrid.ClearSelection(); }