private void simpleButtonPrint_Click(object sender, EventArgs e) { try { foreach (Binding X in NalazBindingSource.CurrencyManager.Bindings) { X.WriteValue(); } var db = new Database(); //FormStampa frm = new FormStampa(nalaz, Baza.hospital.First(qq => qq.id_hospital == (int)lookUpEditHospital.EditValue).naziv, Baza.modalitet.First(qq => qq.id_modalitet == (int)lookUpEditModalitet.EditValue).naziv, Baza.operater.First(qq => qq.id_operater == (int)lookUpEditOperater.EditValue).info_naziv, Baza.doktor.First(qq => qq.id_doktor == (int)lookUpEditDoktor.EditValue).info_naziv); FormStampa frm = new FormStampa(db.nalaz.FirstOrDefault(qq => qq.id_nalaz == nalaz.id_nalaz)); //frm.ShowDialog(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }
private void simpleButtonSave_Click(object sender, EventArgs e) { try { if (isEdit && validate()) { Baza.SaveChanges(); //XtraMessageBox.Show("Sačuvano", "Izmjena", MessageBoxButtons.OK, MessageBoxIcon.Information); if (XtraMessageBox.Show("Uspješno izmijenjen nalaz." + Environment.NewLine + "Štampati nalaz?", "Novi nalaz", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.Close(); var db = new Database(); FormStampa frm = new FormStampa(db.nalaz.FirstOrDefault(qq => qq.id_nalaz == nalaz.id_nalaz)); //simpleButtonPrint.PerformClick(); } this.Close(); } if (!isEdit && validate()) { Baza.nalaz.Add(nalaz); Baza.SaveChanges(); if (XtraMessageBox.Show("Uspješno sačuvan nalaz." + Environment.NewLine + "Štampati nalaz?", "Novi nalaz", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.Close(); var db = new Database(); FormStampa frm = new FormStampa(db.nalaz.FirstOrDefault(qq => qq.id_nalaz == nalaz.id_nalaz)); //simpleButtonPrint.PerformClick(); } this.Close(); } } catch (Exception ex) { XtraMessageBox.Show("Došlo je do greške prilikom izvršenja." + Environment.NewLine + ex.Message); } }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var row = (nalaz)gridView1.GetRow(gridView1.FocusedRowHandle); FormStampa frm = new FormStampa(row); //frm.ShowDialog(); }