private void SellMedic() { uint tottal = 0; try { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("medics").Where("Name", PName.Text).Execute(); MySqlReader r = new MySqlReader(cmd); if (r.Read()) { tottal = r.ReadUInt32("Count"); } if (tottal > 0) { tottal = --tottal; PTottal.Clear(); PTottal.Text = tottal.ToString(); MySqlCommand CMD = new MySqlCommand(MySqlCommandType.UPDATE); CMD.Update("medics") .Set("Count", tottal); CMD.Where("Name", PName.Text).Execute(); MessageBox.Show("تم بيع واحد"); SaveSold(); } else { MessageBox.Show("الدواء غير متوفر"); } } catch (Exception ep) { MessageBox.Show(ep.ToString()); } }
private void clear() { PName.Clear(); PEXP.Clear(); PTottal.Clear(); PCost.Clear(); PSubS.Clear(); Pnote.Clear(); }