private void SelectInstitutionButton_Click(object sender, EventArgs e) { // inicjalizacja SqlCommand Command = new SqlCommand(); Command.CommandText = "EXEC Czasop_InstitutionsList; "; DataGridViewColumn[] Columns = new DataGridViewColumn[2]; Columns[0] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[0].DataPropertyName = "nazwa_inst"; Columns[0].Name = "nazwa_inst"; Columns[0].HeaderText = "Nazwa wydawcy"; Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; Columns[1] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[1].DataPropertyName = "siedziba"; Columns[1].Name = "siedziba"; Columns[1].HeaderText = "Miasto"; Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; ShowForm Formka = new ShowForm(Command, Columns); if (Formka.ShowDialog() == DialogResult.OK) { // przypisanie siedziby i nazwy instytucji NameTextBox.Text = Formka.Dt.Cells["nazwa_inst"].Value.ToString(); PlaceTextBox.Text = Formka.Dt.Cells["siedziba"].Value.ToString(); } }
private void SelectButton_Click(object sender, EventArgs e) { SqlCommand Command = new SqlCommand("EXEC CountryList;"); DataGridViewColumn[] Columns = new DataGridViewColumn[2]; Columns[0] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[0].DataPropertyName = "kod"; Columns[0].Name = "Kod"; Columns[0].HeaderText = _translationsDictionary.getStringFromDictionary("code", "Kod"); Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; Columns[1] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[1].DataPropertyName = "p_sk_nazwa"; Columns[1].Name = "Państwo"; Columns[1].HeaderText = _translationsDictionary.getStringFromDictionary("country", "Państwo"); Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; ShowForm Publisher = new ShowForm(Command, Columns); Publisher.Text = _translationsDictionary.getStringFromDictionary("choose_country", "Wybierz państwo"); if (Publisher.ShowDialog() == System.Windows.Forms.DialogResult.OK) { CountryTextBox.Text = Publisher.Dt.Cells["Kod"].Value.ToString(); } }
public static void ChangeTitle(int id_rodzaj, Form mdiParent) { if (!_translationsDictionary.Any()) { getTranslations(); } Settings.SetSettings(id_rodzaj); Settings.Search_ID_rodzaj = id_rodzaj; SqlCommand Command = new SqlCommand("EXEC Czasop_MagazinesList @id_rodzaj, @seryjne, @sort; "); Command.Parameters.AddWithValue("@id_rodzaj", Settings.Search_ID_rodzaj); Command.Parameters.AddWithValue("@seryjne", 0); Command.Parameters.AddWithValue("@sort", 1); DataGridViewColumn[] Columns = new DataGridViewColumn[4]; Columns[0] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[0].DataPropertyName = "id"; Columns[0].Name = "id"; Columns[0].Visible = false; Columns[1] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[1].DataPropertyName = "tytul"; Columns[1].Name = "tytul"; Columns[1].HeaderText = _translationsDictionary.getStringFromDictionary("magazine_title", "Tytuł czasopisma"); Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; Columns[2] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[2].DataPropertyName = "syg"; Columns[2].Name = "syg"; Columns[2].HeaderText = _translationsDictionary.getStringFromDictionary("signature", "Sygnatura"); Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; Columns[3] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[3].DataPropertyName = "id_rodzaj"; Columns[3].Name = "id_rodzaj"; Columns[3].Visible = false; ShowForm Formka = new ShowForm(Command, Columns); Formka.Text = _translationsDictionary.getStringFromDictionary("select", "Wybieranie"); if (Formka.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ChangeTitleForm CTF = new ChangeTitleForm(Formka.Dt.Cells["id"].Value.ToString(), id_rodzaj, false, false); CTF.MdiParent = mdiParent; CTF.Show(); //CTF.ShowDialog(); } }
private void MagazinesList(bool IsNext) { SqlCommand Command = new SqlCommand("EXEC Czasop_MagazinesList @id_rodzaj, @seryjne; "); Command.Parameters.AddWithValue("@id_rodzaj", Settings.ID_rodzaj); Command.Parameters.AddWithValue("@seryjne", this.Seryjne); DataGridViewColumn[] Columns = new DataGridViewColumn[3]; Columns[0] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[0].DataPropertyName = "id"; Columns[0].Name = "id"; Columns[0].Visible = false; Columns[2] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[2].DataPropertyName = "tytul"; Columns[2].Name = "tytul"; Columns[2].HeaderText = _translationsDictionary.getStringFromDictionary("magazine_title", "Tytuł czasopisma"); Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; Columns[1] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[1].DataPropertyName = "syg"; Columns[1].Name = "syg"; Columns[1].HeaderText = _translationsDictionary.getStringFromDictionary("signature", "Sygnatura"); Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; ShowForm Formka = new ShowForm(Command, Columns); Formka.Text = _translationsDictionary.getStringFromDictionary("select", "Wybieranie"); if (Formka.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (Formka.Dt.Cells["id"].Value.ToString() == CurrentID) { MessageBox.Show(_translationsDictionary.getStringFromDictionary("this_magazine_cannot_join", "Tego czasopisma nie można dołączyć!"), "", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { AddTitle(CurrentID, Formka.Dt.Cells["id"].Value.ToString(), IsNext); } } }
private void ShowList(int Sort) { SqlCommand Command = new SqlCommand("EXEC Czasop_MagazinesList @id_rodzaj, @seryjne, @sort; "); Command.Parameters.AddWithValue("@id_rodzaj", Settings.Search_ID_rodzaj); if (CurrentModeEnum == ModeEnum.Edit) { Command.Parameters.AddWithValue("@seryjne", !Seryjne ? 0 : 1); } else { Command.Parameters.AddWithValue("@seryjne", 2); } Command.Parameters.AddWithValue("@sort", Sort); DataGridViewColumn[] Columns = new DataGridViewColumn[5]; Columns[0] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[0].DataPropertyName = "id"; Columns[0].Name = "id"; Columns[0].Visible = false; Columns[1] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[1].DataPropertyName = "tytul"; Columns[1].Name = "tytul"; Columns[1].HeaderText = _translationsDictionary.getStringFromDictionary("magazine_title", "Tytuł czasopisma"); Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; Columns[2] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[2].DataPropertyName = "syg"; Columns[2].Name = "syg"; Columns[2].HeaderText = _translationsDictionary.getStringFromDictionary("signature", "Sygnatura"); Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; Columns[3] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[3].DataPropertyName = "id_rodzaj"; Columns[3].Name = "id_rodzaj"; Columns[3].Visible = false; Columns[4] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[4].DataPropertyName = "seryjne"; Columns[4].Name = "seryjne"; Columns[4].Visible = false; ShowForm Formka = new ShowForm(Command, Columns, Sort == 1 ? "tytul" : "syg", "M", CurrentModeEnum); Formka.Text = _translationsDictionary.getStringFromDictionary("select", "Wybieranie"); if (Formka.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (CurrentModeEnum == ModeEnum.Edit) { MagazineForm MF = new MagazineForm(Int32.Parse(Formka.Dt.Cells["id_rodzaj"].Value.ToString()), Formka.Dt.Cells["id"].Value.ToString(), Settings.employeeID, Seryjne); MF.MdiParent = this.MdiParent; MF.Show(); //MF.ShowDialog(); } else if (CurrentModeEnum == ModeEnum.Delete) { MagazineForm MF = new MagazineForm(Formka.Dt.Cells["id"].Value.ToString(), Settings.employeeID, (bool)Formka.Dt.Cells["seryjne"].Value); MF.MdiParent = this.MdiParent; MF.Show(); //MF.ShowDialog(); } } }