private void SellB_Click(object sender, EventArgs e) { BillsTable.Client = Client.Text; BillsTable.MName = PName.Text; BillsTable.MCost = Convert.ToDecimal(PCost.Text); if (PName.Text != "" && Client.Text != "" && NewBill.Checked) { SellMedic(); BillsTable.newbill(); BillNO.Text = BillsTable.BillNO.ToString(); } else if (PName.Text != "" && Client.Text != "" && !NewBill.Checked) { SellMedic(); BillsTable.updatebill(); } else if (Client.Text == "") { MessageBox.Show("ادخل اسم المشترى"); } else { MessageBox.Show("الدواء غير متوفر"); } }
private void SellB_Click(object sender, EventArgs e) { BillsTable.Client = Client.Text; BillsTable.MName = PName.Text; BillsTable.MCost = Convert.ToDecimal(PCost.Text); if (PName.Text != "" && Client.Text != "" && NewBill.Checked) { SellMedic(); if (SellCom != true) { return; } BillsTable.newbill(); try { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bills").Order("ID"); MySqlReader r = new MySqlReader(cmd); if (r.Read()) { BillNO.Text = r.ReadString("ID"); } r.Close(); SellCom = false; } catch (Exception el) { Program.SaveException(el); } } else if (PName.Text != "" && Client.Text != "" && !NewBill.Checked) { SellMedic(); if (SellCom == false) { return; } BillsTable.updatebill(); SellCom = false; } else if (PName.Text == "" || PCost.Text == "") { MessageBox.Show("لا يوجد دواء"); } else if (Client.Text == "") { MessageBox.Show("ادخل اسم المشترى"); } else { MessageBox.Show("الدواء غير متوفر"); } }
private void SellM_Click(object sender, RoutedEventArgs e) { if (MName.Text == "" || MPrice.Text == "" || MExist.Text == "" || MWSell.Text == "") { MessageBox.Show("لا يمكن اتمام عمليه البيع بسبب وجود حقل مهم فارغ"); return; } if (EnBills.IsChecked == true) { BillsTable.bClient = Client.Text; BillsTable.bMName = MName.Text; BillsTable.bMCost = Convert.ToDecimal(MPrice.Text) * Convert.ToDecimal(MWSell.Text); if (MName.Text != "" && Client.Text != "" && NewBill.IsChecked == true) { SellMedic(); if (CompleteSelling != true) { return; } BillsTable.newbill(); try { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bills").Order("ID"); MySqlReader r = new MySqlReader(cmd); if (r.Read()) { BillNo.Text = r.ReadString("ID"); } r.Close(); CompleteSelling = false; } catch (Exception ex) { Core.SaveException(ex); } } else if (MName.Text != "" && Client.Text != "" && NewBill.IsChecked == false) { SellMedic(); if (CompleteSelling == false) { return; } BillsTable.updatebill(); CompleteSelling = false; } else if (Client.Text == "") { MessageBox.Show("ادخل اسم المشترى/العميل"); } else { MessageBox.Show("الدواء غير متوفر"); } } else { SellMedic(); CompleteSelling = false; } }