/// <summary> /// /// </summary> /// <param name="searchDetails"></param> private void SelectColumProduce(SearchDetails searchDetails) { double temp; DateTime dateTime; switch (searchDetails.ColumIndex) { case (int)ProductColums.Date_Asc: if (searchDetails.DateTimeConverter(out dateTime)) { produkt = SQLSearch.SearchProductsDateAsc(produkt, dateTime); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct date!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)ProductColums.Date_Des: if (searchDetails.DateTimeConverter(out dateTime)) { produkt = SQLSearch.SearchProductsDateDes(produkt, dateTime); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct date!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)ProductColums.Farmer: produkt = SQLSearch.SearchProductsFarmer(produkt, searchDetails.searchstring); break; case (int)ProductColums.Produce: produkt = SQLSearch.SearchProductsProduce(produkt, searchDetails.searchstring); break; case (int)ProductColums.Price_Asc: if (double.TryParse(searchDetails.searchstring, out temp)) { produkt = SQLSearch.SearchProductsPriceAsc(produkt, temp); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct dezimal number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)ProductColums.Price_Des: if (double.TryParse(searchDetails.searchstring, out temp)) { produkt = SQLSearch.SearchProductsPriceDesc(produkt, temp); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct dezimal number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)ProductColums.Unit: produkt = SQLSearch.SearchProductsUnit(produkt, searchDetails.searchstring); break; case (int)ProductColums.Quantity_Asc: if (double.TryParse(searchDetails.searchstring, out temp)) { produkt = SQLSearch.SearchProductsQuantityAsc(produkt, temp); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct dezimal number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)ProductColums.Quantity_Des: if (double.TryParse(searchDetails.searchstring, out temp)) { produkt = SQLSearch.SearchProductsQuantityDesc(produkt, temp); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct dezimal number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; default: break; } }
/// <summary> /// /// </summary> /// <param name="index"></param> private void SelectColumCustomer(SearchDetails searchDetails) { bool result; DateTime dateTime; switch (searchDetails.ColumIndex) { case (int)CustomerColums.Date_Asc: if (searchDetails.DateTimeConverter(out dateTime)) { customer = SQLSearch.SearchCustomerDateAsc(customer, dateTime); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct date!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)CustomerColums.Date_Des: if (searchDetails.DateTimeConverter(out dateTime)) { customer = SQLSearch.SearchCustomerDateDes(customer, dateTime); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct date!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)CustomerColums.FullName: customer = SQLSearch.SearchCustomerName(customer, searchDetails.searchstring); break; case (int)CustomerColums.EMail: customer = SQLSearch.SearchCustomerMail(customer, searchDetails.searchstring); break; case (int)CustomerColums.Phone: customer = SQLSearch.SearchCustomerPhone(customer, searchDetails.searchstring); break; case (int)CustomerColums.CSA: if (bool.TryParse(searchDetails.searchstring, out result)) { customer = SQLSearch.SearchCustomerCSA(customer, result); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter true or false!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)CustomerColums.HorsBarn: if (bool.TryParse(searchDetails.searchstring, out result)) { customer = SQLSearch.SearchCustomerHorseBarn(customer, result); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter true or false!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)CustomerColums.Neigtbar: if (bool.TryParse(searchDetails.searchstring, out result)) { customer = SQLSearch.SearchCustomerNeighbarhood(customer, result); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter true or false!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; default: break; } }
/// <summary> /// /// </summary> /// <param name="searchDetails"></param> private void SelectColumExpenses(SearchDetails searchDetails) { double temp; DateTime dateTime; switch (searchDetails.ColumIndex) { case (int)ExpensesColums.Date_Asc: if (searchDetails.DateTimeConverter(out dateTime)) { expense = SQLSearch.SearchExpenseDateAsc(expense, dateTime); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct date!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)ExpensesColums.Date_Des: if (searchDetails.DateTimeConverter(out dateTime)) { expense = SQLSearch.SearchExpenseDateDes(expense, dateTime); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct date!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)ExpensesColums.Dealer: expense = SQLSearch.SearchExpenseDealer(expense, searchDetails.searchstring); break; case (int)ExpensesColums.Price: if (double.TryParse(searchDetails.searchstring, out temp)) { expense = SQLSearch.SearchExpensePrice(expense, temp); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct dezimal number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)ExpensesColums.Details: expense = SQLSearch.SearchExpenseDetails(expense, searchDetails.searchstring); break; case (int)ExpensesColums.Price_Des: if (double.TryParse(searchDetails.searchstring, out temp)) { expense = SQLSearch.SearchExpensePriceDesc(expense, temp); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct dezimal number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)ExpensesColums.Price_Asc: if (double.TryParse(searchDetails.searchstring, out temp)) { expense = SQLSearch.SearchExpensePriceAsc(expense, temp); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct dezimal number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; default: break; } }
/// <summary> /// /// </summary> /// <param name="index"></param> private void SelectColumIncome(SearchDetails searchDetails) { double temp; DateTime dateTime; switch (searchDetails.ColumIndex) { case (int)IncomeColuems.Date_Asc: if (searchDetails.DateTimeConverter(out dateTime)) { income = SQLSearch.SearchIncomeDateAsc(income, dateTime); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct date!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)IncomeColuems.Date_Des: if (searchDetails.DateTimeConverter(out dateTime)) { income = SQLSearch.SearchIncomeDateDes(income, dateTime); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct date!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)IncomeColuems.FullName: income = SQLSearch.SearchIncomeName(income, searchDetails.searchstring); break; case (int)IncomeColuems.Price: if (double.TryParse(searchDetails.searchstring, out temp)) { income = SQLSearch.SearchIncomePrice(income, temp); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct dezimal number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)IncomeColuems.Products: income = SQLSearch.SearchIncomeProduct(income, searchDetails.searchstring); break; case (int)IncomeColuems.Price_Des: if (double.TryParse(searchDetails.searchstring, out temp)) { income = SQLSearch.SearchIncomePriceDesc(income, temp); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct dezimal number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case (int)IncomeColuems.Price_Asc: if (double.TryParse(searchDetails.searchstring, out temp)) { income = SQLSearch.SearchIncomePriceAsce(income, temp); } else { MetroFramework.MetroMessageBox.Show(this, "Please enter a correct dezimal number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; default: break; } }
private void SearchButton_Click(object sender, EventArgs e) { SQLSearch search = new SQLSearch(AddressTextbox.Text); }