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(); }
//public SupplyDTO InsertSupplyInformation(SupplyDTO supply) //{ // var supplyRepository = new SupplyRepository(); // return supplyRepository.InsertSupply(supply); //} public List <SupplyDTO> ListAllSupplyInformation() { var supplyRepository = new SupplyRepository(); return(supplyRepository.GetSupplies()); }