private void button2_Click(object sender, EventArgs e) { gasValue = null; if (gasValue == null && MyGasValidate()) gasValue = new Gas(GasCompName.Text, GasNewNumb.Text + GasOldNumb.Text, GasModel.Text, Convert.ToInt32(GasDogNumb.Text), GasDogDate.Value, GasSelectedValue, dateTimePicker1.Value); if (gasValue != null) { printGasDoc.Print(); } }
private void button3_Click(object sender, EventArgs e) { gasValue = null; if (MyGasValidate()) gasValue = new Gas(GasCompName.Text, GasNewNumb.Text + GasOldNumb.Text, GasModel.Text, Convert.ToInt32(GasDogNumb.Text), GasDogDate.Value, GasSelectedValue, dateTimePicker1.Value); if (gasValue != null) { prewiewPrintDialog.Document = printGasDoc; try { prewiewPrintDialog.ShowDialog(); } catch { MessageBox.Show("В системе не найдено установленных принтеров", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
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(); } }