private void ChooseLanguageButton_Click(object sender, EventArgs e) { SqlCommand Command = new SqlCommand(); Command.CommandText = "EXEC ZwrocJezyki;"; 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[1] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[1].DataPropertyName = "jezyk"; Columns[1].Name = "Język"; Columns[1].HeaderText = _translationsDictionary.getStringFromDictionary("language", "Język"); ShowForm SF = new ShowForm(Command, Columns); SF.Width = 400; if (SF.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (SF.Dt != null) { LanguageTextBox.Text = SF.Dt.Cells["kod"].Value.ToString(); } } }
private void ChooseBookButton_Click(object sender, EventArgs e) { WaitForm WF = new WaitForm(); this.Invoke((MethodInvoker) delegate { WF.Show(this); WF.Update(); }); SqlCommand Command = new SqlCommand(); Command.CommandText = "EXEC ZwrocListeKsiazek @id_rodzaj, @sort;"; Command.Parameters.AddWithValue("@id_rodzaj", Settings.ID_rodzaj); Command.Parameters.AddWithValue("@sort", 1); DataGridViewColumn[] Columns = new DataGridViewColumn[3]; Columns[0] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[0].DataPropertyName = "tytul_gl"; Columns[0].Name = "tytul_gl"; Columns[0].HeaderText = _translationsDictionary.getStringFromDictionary("book_title", "Tytuł książki"); Columns[0].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].Width = 150; Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.None; Columns[2] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[2].DataPropertyName = "kod"; Columns[2].Name = "kod"; Columns[2].Visible = false; Columns[2].Width = 0; /*Columns[3] = new DataGridViewColumn(new DataGridViewTextBoxCell()); * Columns[3].DataPropertyName = "wydawca"; * Columns[3].Name = "wydawca"; * Columns[3].Visible = false; * Columns[3].Width = 0; * * Columns[4] = new DataGridViewColumn(new DataGridViewTextBoxCell()); * Columns[4].DataPropertyName = "miasto_w"; * Columns[4].Name = "miasto_w"; * Columns[4].Visible = false; * Columns[4].Width = 0; * * Columns[5] = new DataGridViewColumn(new DataGridViewTextBoxCell()); * Columns[5].DataPropertyName = "rok_wyd"; * Columns[5].Name = "rok_wyd"; * Columns[5].Visible = false; * Columns[5].Width = 0; * * Columns[6] = new DataGridViewColumn(new DataGridViewTextBoxCell()); * Columns[6].DataPropertyName = "autorzy"; * Columns[6].Name = "autorzy"; * Columns[6].Visible = false; * Columns[6].Width = 0;*/ ShowForm SF = new ShowForm(Command, Columns); SF.ShowRadioButtons(); WF.Close(); if (SF.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (SF.Dt != null) { Clear(); ID = SF.Dt.Cells["kod"].Value.ToString(); Command = new SqlCommand(); Command.Parameters.Clear(); Command.CommandText = "EXEC Artykuly_InformacjeOKsiazce @kod; "; Command.Parameters.AddWithValue("@kod", ID); DataTable Dt = CommonFunctions.ReadData(Command, ref Settings.Connection); if (Dt.Rows.Count > 0) { if (!string.IsNullOrEmpty(Dt.Rows[0]["wydawca"].ToString())) { PublisherTextBoxValue = Dt.Rows[0]["wydawca"].ToString(); } if (!string.IsNullOrEmpty(Dt.Rows[0]["miasto_w"].ToString())) { PlaceTextBoxValue = Dt.Rows[0]["miasto_w"].ToString(); } if (!string.IsNullOrEmpty(Dt.Rows[0]["rok_wyd"].ToString())) { YearTextBoxValue = Dt.Rows[0]["rok_wyd"].ToString(); } if (!string.IsNullOrEmpty(Dt.Rows[0]["tytul_gl"].ToString())) { SourceTitleRichTextBoxValue = Dt.Rows[0]["tytul_gl"].ToString(); } if (!string.IsNullOrEmpty(Dt.Rows[0]["syg"].ToString())) { SygnaturaTextBoxValue = Dt.Rows[0]["syg"].ToString(); } if (!string.IsNullOrEmpty(Dt.Rows[0]["autorzy"].ToString())) { BookAuhorsRichTextBoxValue = Dt.Rows[0]["autorzy"].ToString(); } BookAuhorsRichTextBoxReadOnly = true; } SourceTitleRichTextBox.ReadOnly = true; SygnaturaTextBox.ReadOnly = true; YearTextBox.ReadOnly = true; PlaceTextBox.ReadOnly = true; SourceTitleRichTextBox.BackColor = Color.FromArgb(BookAuhorsRichTextBox.BackColor.ToArgb()); PublisherTextBox.ReadOnly = true; } } }
public static bool ShowAllArticles(ArtykulyForm.ModeEnum CurrentMode, Form mdiParent) { SqlCommand Command = new SqlCommand(); Command.CommandText = "EXEC ZwrocListeArtykulow @id_rodzaj;"; Command.Parameters.AddWithValue("@id_rodzaj", Settings.Search_ID_rodzaj); DataGridViewColumn[] Columns = new DataGridViewColumn[7]; Columns[0] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[0].DataPropertyName = "tytul_artykulu"; Columns[0].Name = "tytul_artykulu"; Columns[0].HeaderText = _translationsDictionary.getStringFromDictionary("article_title", "Tytuł artykułu"); Columns[0].MinimumWidth = 500; Columns[1] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[1].DataPropertyName = "tytul_ksiazki"; Columns[1].Name = "Tytuł książki"; Columns[1].HeaderText = _translationsDictionary.getStringFromDictionary("book_title", "Tytuł książki"); Columns[1].Width = 242; Columns[2] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[2].DataPropertyName = "tytul_czasopisma"; Columns[2].Name = "Tytuł czasopisma"; Columns[2].HeaderText = _translationsDictionary.getStringFromDictionary("magazine_title", "Tytuł czasopisma"); Columns[3] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[3].DataPropertyName = "rodzaj_zas"; Columns[3].Name = "rodzaj_zas"; Columns[3].Visible = false; Columns[4] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[4].DataPropertyName = "kod"; Columns[4].Name = "kod"; Columns[4].Visible = false; Columns[5] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[5].DataPropertyName = "kod_zas"; Columns[5].Name = "kod_zas"; Columns[5].Visible = false; Columns[6] = new DataGridViewColumn(new DataGridViewTextBoxCell()); Columns[6].DataPropertyName = "id_rodzaj"; Columns[6].Name = "id_rodzaj"; Columns[6].Visible = false; ShowForm SF = new ShowForm(Command, Columns); if (SF.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (SF.Dt != null) { Int32.TryParse(SF.Dt.Cells["id_rodzaj"].Value.ToString().Trim(), out Settings.ID_rodzaj); if (SF.Dt.Cells["rodzaj_zas"].Value.ToString().ToLower().Trim() == "k") { ArtykulyForm AF = new ArtykulyForm(ArtykulyForm.KindEnum.Book, CurrentMode, SF.Dt.Cells["kod"].Value.ToString().Trim()); //AF.ShowDialog(); AF.MdiParent = mdiParent; AF.Show(); return(AF.ShowList); } else if (SF.Dt.Cells["rodzaj_zas"].Value.ToString().ToLower().Trim() == "c") { ArtykulyForm AF = new ArtykulyForm(ArtykulyForm.KindEnum.Magazine, CurrentMode, SF.Dt.Cells["kod"].Value.ToString().Trim()); //AF.ShowDialog(); AF.MdiParent = mdiParent; AF.Show(); return(AF.ShowList); } } } return(false); }