| 1 | private void szukajToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 2 | {
|
|---|
| 3 | /*
|
|---|
| 4 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 5 |
|
|---|
| 6 | string query = "SELECT top 1000 [PLAN].* FROM AGENCJE INNER JOIN AGENCI ON AGENCJE.Id_agencji = AGENCI.ID_AGENCJI " +
|
|---|
| 7 | " INNER JOIN [PLAN] ON AGENCI.Symbol = [PLAN].SYMBOL WHERE 1 = 1 ";
|
|---|
| 8 |
|
|---|
| 9 | SqlCommand command = new SqlCommand();
|
|---|
| 10 | command.CommandText = query;
|
|---|
| 11 |
|
|---|
| 12 | if (rokToolStripTextBox.Text != "")
|
|---|
| 13 | {
|
|---|
| 14 | short i;
|
|---|
| 15 | if (!Int16.TryParse(rokToolStripTextBox.Text, out i))
|
|---|
| 16 | {
|
|---|
| 17 | MessageBox.Show("Podaj prawid³owy rok.");
|
|---|
| 18 | this.Cursor = Cursors.Default;
|
|---|
| 19 | return;
|
|---|
| 20 | }
|
|---|
| 21 | command.CommandText += " AND [PLAN].rok = @rok ";
|
|---|
| 22 | command.Parameters.AddWithValue("@rok", rokToolStripTextBox.Text);
|
|---|
| 23 | this.rok = Convert.ToInt16(rokToolStripTextBox.Text);
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | if (msToolStripTextBox.Text != "")
|
|---|
| 27 | {
|
|---|
| 28 | short i;
|
|---|
| 29 | if (!Int16.TryParse(msToolStripTextBox.Text, out i))
|
|---|
| 30 | {
|
|---|
| 31 | MessageBox.Show("Podaj prawid³owy miesi¹c.");
|
|---|
| 32 | this.Cursor = Cursors.Default;
|
|---|
| 33 | return;
|
|---|
| 34 | }
|
|---|
| 35 | command.CommandText += " AND [PLAN].ms = @ms ";
|
|---|
| 36 | command.Parameters.AddWithValue("ms", msToolStripTextBox.Text);
|
|---|
| 37 | this.miesiac = Convert.ToInt16(msToolStripTextBox.Text);
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | if (((ComboBox)agencjaToolStripComboBox.Control).SelectedValue == null)
|
|---|
| 41 | {
|
|---|
| 42 | MessageBox.Show("Wybierz agencjê");
|
|---|
| 43 | return;
|
|---|
| 44 | }
|
|---|
| 45 | else
|
|---|
| 46 | {
|
|---|
| 47 | command.CommandText += " AND AGENCJE.Id_Agencji=@agencja";
|
|---|
| 48 | command.Parameters.AddWithValue("@agencja", ((ComboBox)agencjaToolStripComboBox.Control).SelectedValue);
|
|---|
| 49 | this.agencja = Convert.ToInt32(((ComboBox)agencjaToolStripComboBox.Control).SelectedValue);
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | // uprawnienia();
|
|---|
| 53 | poblokujWiersze();
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | this.sLOWNIKDataSet.AGENCI.Clear();
|
|---|
| 57 | this.aGENCITableAdapter.FillByIdAgencji(this.sLOWNIKDataSet.AGENCI, this.agencja);
|
|---|
| 58 |
|
|---|
| 59 | this.rEKLAMADataSet.PLAN.Clear();
|
|---|
| 60 | // this.pLANTableAdapter.FillByAgencja(this.rEKLAMADataSet.PLAN, this.rok, this.miesiac, this.agencja);
|
|---|
| 61 |
|
|---|
| 62 | command.Connection = new SqlConnection(ConnString.getConnString().Value);
|
|---|
| 63 | SqlDataAdapter adapter = new SqlDataAdapter();
|
|---|
| 64 | adapter.SelectCommand = command;
|
|---|
| 65 |
|
|---|
| 66 | adapter.Fill(rEKLAMADataSet.PLAN);
|
|---|
| 67 |
|
|---|
| 68 | this.Cursor = Cursors.Default;
|
|---|
| 69 | *
|
|---|
| 70 | * */
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | /*
|
|---|
| 74 | private void poblokujWiersze()
|
|---|
| 75 | {
|
|---|
| 76 | if (User.getUser().St_kierownik)
|
|---|
| 77 | {
|
|---|
| 78 | foreach (DataGridViewRow r in prowizjeDataGridView.Rows)
|
|---|
| 79 | {
|
|---|
| 80 |
|
|---|
| 81 | if (!((Convert.ToInt32(r.Cells["Rok"].Value) > DateTime.Today.Year) |
|
|---|
| 82 | ((Convert.ToInt32(r.Cells["Rok"].Value) == DateTime.Today.Year) & (Convert.ToInt32(r.Cells["ms"].Value) >= DateTime.Today.Month - 1)) |
|
|---|
| 83 | ((Convert.ToInt32(r.Cells["Rok"].Value) == DateTime.Today.Year - 1) & (Convert.ToInt32(r.Cells["ms"].Value) == 12) & (DateTime.Today.Month == 1))))
|
|---|
| 84 | {
|
|---|
| 85 | r.ReadOnly = true;
|
|---|
| 86 | }
|
|---|
| 87 | }
|
|---|
| 88 | }
|
|---|
| 89 | }*/ |
|---|