private void NewWydSerButton_Click(object sender, EventArgs e) { MagazineForm MF = new MagazineForm(Settings.ID_rodzaj, Settings.employeeID, true); MF.MdiParent = this.MdiParent; MF.Show(); //MF.ShowDialog(); }
private void SelectButton_Click(object sender, EventArgs e) { if (cTryb == "M" && CurrentMode == ChooseForm.ModeEnum.Edit) { Dt = dataGridView1.CurrentRow; if (CurrentMode == ChooseForm.ModeEnum.Edit) { MagazineForm MF = new MagazineForm(Int32.Parse(Dt.Cells["id_rodzaj"].Value.ToString()), Dt.Cells["id"].Value.ToString(), Settings.employeeID, (bool)Dt.Cells["seryjne"].Value); MF.MdiParent = this.MdiParent; MF.Show(); //MF.ShowDialog(); } else if (CurrentMode == ChooseForm.ModeEnum.Delete) { MagazineForm MF = new MagazineForm(Dt.Cells["id"].Value.ToString(), Settings.employeeID, (bool)Dt.Cells["seryjne"].Value); MF.MdiParent = this.MdiParent; MF.Show(); //MF.ShowDialog(); } return; } if (dataGridView1.SelectedRows.Count > 0) { if (Column1 != null && dataGridView1.Columns.Contains(Column1)) { this.First = dataGridView1[Column1, dataGridView1.CurrentCell.RowIndex].Value.ToString(); } if (Column1 != null && dataGridView1.Columns.Contains(Column2)) { this.Second = dataGridView1[Column2, dataGridView1.CurrentCell.RowIndex].Value.ToString(); } if (dataGridView1.Columns.Contains("id") && dataGridView1.SelectedRows.Count > 0) { ID = dataGridView1["id", dataGridView1.CurrentCell.RowIndex].Value.ToString(); } Dt = dataGridView1.CurrentRow; this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { this.DialogResult = System.Windows.Forms.DialogResult.No; } this.Close(); }
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(); } } }