private void SupplyForm_VisibleChanged(object sender, EventArgs e) { if (Visible && supplyID == -1) { SupplyGrid.ClearSelection(); } }
private void CancelButton_Click(object sender, EventArgs e) { SupplyErrorProvider.Clear(); if (supplyID > 0) { ViewSupplyDetailTab(supplyID, false); } else { ViewSupplyListingTab(); supplyID = -1; SupplyGrid.ClearSelection(); } }
private void FilterButton_Click(object sender, EventArgs e) { var filter = new SupplyFilter { ID = FilterIDTextBox.Text.AsInt(), SupplierName = FilterSupplierNameTextBox.Text, ComponentID = (FilterComponentDropDown.SelectedValue.AsInt() == 0) ? null : FilterComponentDropDown.SelectedValue.AsInt(), DeliveredFrom = (FilterDeliveredFromDatePicker.Format == DateTimePickerFormat.Custom) ? null : FilterDeliveredFromDatePicker.Value.Date.AsDateTime(), DeliveredTo = (FilterDeliveredToDatePicker.Format == DateTimePickerFormat.Custom) ? null : FilterDeliveredToDatePicker.Value.Date.AsDateTime(), IsNotApprovedOnly = FilterIsNotApprovedOnlyCheckBox.Checked }; using (var repository = new SupplyRepository()) { SupplyGrid.DataSource = repository.GetSupplies(filter); } SupplyGrid.ClearSelection(); }