private void buttonX2_Click(object sender, EventArgs e) { if (getValue(0) == null) { } else { try { BillsHistory billHistoryObj = new BillsHistory(); billHistoryObj.Amount = getValue(2).ToString(); billHistoryObj.BillNo = getValue(1).ToString(); billHistoryObj.Date = DateTime.Now; billHistoryObj.PatientName = getValue(3).ToString(); billHistoryObj.ReceptionistName = getValue(4).ToString(); biHiBL.Create(billHistoryObj); BillFactor billFactor = new BillFactor(); billFactor.BillNo = billHistoryObj.BillNo; billFactor.Amount = billHistoryObj.Amount; billFactor.Date = billHistoryObj.Date; billFactor.PatientName = billHistoryObj.PatientName; billFactor.ReceptionistName = billHistoryObj.ReceptionistName; Receptionist_PrintFactor frm = new Receptionist_PrintFactor(billFactor); frm.ShowDialog(); Bill obj = new Bill(); obj.Id = (int)getValue(0); BL.Delete(obj); refresh(); if (dataGridView1.SelectedCells.Count > 0) { labelX4.Text = getValue(1).ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "خطا"); } } }
private void buttonX2_Click(object sender, EventArgs e) { if (getValue(0) == null) { } else { try { Bill obj = new Bill(); obj.Id = (int)getValue(0); BL.Delete(obj); refresh(); if (dataGridView1.SelectedCells.Count > 0) { labelX4.Text = getValue(1).ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "خطا"); } } }