private void setFilterDataCommnadText(ref SQLSelectCommandModel command) { //Don't Modify if allRadioButton is true if (allRadioButton.Checked) { return; //End Execution } //Then Custom is truex.Checked) //TOP if (topRowsCheckBox.Checked) { command.Top = "TOP " + topRowsIntInput.Value; } //WHERE if (notReturnedCheckBox.Checked) { if (!command.WhereText.Equals("")) { command.WhereText += " AND "; } command.WhereText = "[memberNo] IN (" + "SELECT [memberNo] FROM [Transaction] WHERE [returnDate] IS NULL" + ")"; } if (notPaidCheckBox.Checked) { //TODO : Filter Not Paid } if (feeRangeCheckBox.Checked) { //TODO : Filter Not Paid } }
private void setSortDataCommandText(ref SQLSelectCommandModel command) { //ORDER BY if (memberIDRadioButton.Checked) { if (!command.OrderByText.Equals("")) { command.OrderByText += ", "; } command.OrderByText = " [memberNo] " + ((memberIDComboBox.SelectedIndex == 0) ? "ASC" : "DESC"); } if (nameRadioButton.Checked) { if (!command.OrderByText.Equals("")) { command.OrderByText += ", "; } command.OrderByText = " [name] " + ((nameComboBox.SelectedIndex == 0) ? "ASC" : "DESC"); } if (ageRadioButton.Checked) { if (!command.OrderByText.Equals("")) { command.OrderByText += ", "; } command.OrderByText = " [dob] " + ((ageComboBox.SelectedIndex == 0) ? "DESC" : "ASC"); } }
public static DataTable SelectFrom(SQLSelectCommandModel commnadModel, string tableName) { DBConnection.OpenConnection(); SqlCommand command = new SqlCommand(); command.Connection = DBConnection.ConnectionString; command.CommandText = commnadModel.CommandText; SqlDataReader reader = command.ExecuteReader(); DataTable table = new DataTable(tableName); table.Load(reader); reader.Close(); DBConnection.CloseConnection(); return(table); }
private void applyButton_Click(object sender, EventArgs e) { dataSet.Tables.Clear(); SQLSelectCommandModel command = new SQLSelectCommandModel(); command.Columns = "*"; command.Table = "Member"; setFilterDataCommnadText(ref command); setSortDataCommandText(ref command); dataSet.Tables.Add(SQLCommandController.SelectFrom(command, "Member")); dataSet.Tables.Add(SuretyController.GetSureties()); report.SetDataSource(dataSet); crystalReportViewer.ReportSource = report; filterSortSlidePanel.IsOpen = false; }
public BookReportViewerForm() { InitializeComponent(); filterSortSlidePanel.IsOpen = false; SQLSelectCommandModel command = new SQLSelectCommandModel(); command.Table = "Book"; command.Columns = "*"; DataSet dataSet = new DataSet(); DataTable table = SQLCommandController.SelectFrom(command, "Book"); dataSet.Tables.Add(table); BookReport report = new BookReport(); report.SetDataSource(dataSet); crystalReportViewer.ReportSource = report; }