private void toolStripButton1_Click(object sender, EventArgs e) { if (tabControl1.SelectedIndex == 0) { int dogNumb = 0; try { dogNumb = Convert.ToInt32(GasDogNumb.Text); } catch { } gasValue = new Gas(GasCompName.Text, GasNewNumb.Text + GasOldNumb.Text, GasModel.Text, dogNumb, GasDogDate.Value, GasSelectedValue, dateTimePicker1.Value); printDialog1.Document = printGasDoc; printDialog1.ShowDialog(); } else { int dogNumb = 0; try { dogNumb = Convert.ToInt32(GasDogNumb.Text); } catch { } dieselValue = new Diesel(DieselCompName.Text, DieselNewNumb.Text + DieselOldNumb.Text, DieselModel.Text, dogNumb, DieselDogDate.Value, DieselSelectedValue, dateTimePicker2.Value); printDialog1.Document = printDieselDoc; printDialog1.ShowDialog(); } }
private void button4_Click(object sender, EventArgs e) { dieselValue = null; if (MyDieselValidate()) dieselValue = new Diesel(DieselCompName.Text, DieselNewNumb.Text + DieselOldNumb.Text, DieselModel.Text, Convert.ToInt32(DieselDogNumb.Text), DieselDogDate.Value, DieselSelectedValue, dateTimePicker2.Value); if (dieselValue != null) { prewiewPrintDialog.Document = printDieselDoc; try { prewiewPrintDialog.ShowDialog(); } catch { MessageBox.Show("В системе не найдено установленных принтеров", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button6_Click(object sender, EventArgs e) { dieselValue = null; if (dieselValue == null && MyDieselValidate()) dieselValue = new Diesel(DieselCompName.Text, DieselNewNumb.Text + DieselOldNumb.Text, DieselModel.Text, Convert.ToInt32(DieselDogNumb.Text), DieselDogDate.Value, DieselSelectedValue, dateTimePicker2.Value); if (dieselValue != null) { printDieselDoc.Print(); } }