private void szukajToolStripButton_Click(object sender, EventArgs e) { /* this.Cursor = Cursors.WaitCursor; string query = "SELECT top 1000 [PLAN].* FROM AGENCJE INNER JOIN AGENCI ON AGENCJE.Id_agencji = AGENCI.ID_AGENCJI " + " INNER JOIN [PLAN] ON AGENCI.Symbol = [PLAN].SYMBOL WHERE 1 = 1 "; SqlCommand command = new SqlCommand(); command.CommandText = query; if (rokToolStripTextBox.Text != "") { short i; if (!Int16.TryParse(rokToolStripTextBox.Text, out i)) { MessageBox.Show("Podaj prawidłowy rok."); this.Cursor = Cursors.Default; return; } command.CommandText += " AND [PLAN].rok = @rok "; command.Parameters.AddWithValue("@rok", rokToolStripTextBox.Text); this.rok = Convert.ToInt16(rokToolStripTextBox.Text); } if (msToolStripTextBox.Text != "") { short i; if (!Int16.TryParse(msToolStripTextBox.Text, out i)) { MessageBox.Show("Podaj prawidłowy miesiąc."); this.Cursor = Cursors.Default; return; } command.CommandText += " AND [PLAN].ms = @ms "; command.Parameters.AddWithValue("ms", msToolStripTextBox.Text); this.miesiac = Convert.ToInt16(msToolStripTextBox.Text); } if (((ComboBox)agencjaToolStripComboBox.Control).SelectedValue == null) { MessageBox.Show("Wybierz agencję"); return; } else { command.CommandText += " AND AGENCJE.Id_Agencji=@agencja"; command.Parameters.AddWithValue("@agencja", ((ComboBox)agencjaToolStripComboBox.Control).SelectedValue); this.agencja = Convert.ToInt32(((ComboBox)agencjaToolStripComboBox.Control).SelectedValue); } // uprawnienia(); poblokujWiersze(); this.sLOWNIKDataSet.AGENCI.Clear(); this.aGENCITableAdapter.FillByIdAgencji(this.sLOWNIKDataSet.AGENCI, this.agencja); this.rEKLAMADataSet.PLAN.Clear(); // this.pLANTableAdapter.FillByAgencja(this.rEKLAMADataSet.PLAN, this.rok, this.miesiac, this.agencja); command.Connection = new SqlConnection(ConnString.getConnString().Value); SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = command; adapter.Fill(rEKLAMADataSet.PLAN); this.Cursor = Cursors.Default; * * */ } /* private void poblokujWiersze() { if (User.getUser().St_kierownik) { foreach (DataGridViewRow r in prowizjeDataGridView.Rows) { if (!((Convert.ToInt32(r.Cells["Rok"].Value) > DateTime.Today.Year) | ((Convert.ToInt32(r.Cells["Rok"].Value) == DateTime.Today.Year) & (Convert.ToInt32(r.Cells["ms"].Value) >= DateTime.Today.Month - 1)) | ((Convert.ToInt32(r.Cells["Rok"].Value) == DateTime.Today.Year - 1) & (Convert.ToInt32(r.Cells["ms"].Value) == 12) & (DateTime.Today.Month == 1)))) { r.ReadOnly = true; } } } }*/