public void AddMedicine() { try { if (CommercialName == null || GenericName == null || Producer == null || Price == null) { throw new ArgumentException("אתה צריך למלא את כל השדות"); } else { string Id = MedicineM.ResolveRxcuiFromName(CommercialName).ToString(); if (Id == "0") { throw new ArgumentException("תרופה לא קיימת "); } MedicineM.AddMedicine(new Medicine(Id, CommercialName, GenericName, Producer, Price, ImageUri)); MedicineIds.Add(Id); (App.Current as App).navigation.MainWindows.comments.Text = "התרופה נוספה בהצלחה"; } } catch (Exception e) { (App.Current as App).navigation.MainWindows.comments.Text = e.Message.ToString(); } }
public void DeleteMedicine() { try { MedicineV = MedicineM.GetMedicine(MedicineSelected); MedicineM.DeleteMedicine(MedicineV); MedicineIds.Remove(MedicineV.Id); (App.Current as App).navigation.MainWindows.comments.Text = "התרופה הוסרה בהצלחה"; } catch (Exception e) { (App.Current as App).navigation.MainWindows.comments.Text = e.Message.ToString(); } }