private void DoktorIlacCikar() { try { if (bsdoktorilac.Current != null) { long IlacId = (bsdoktorilac.Current as DoktorIlac).Ilac.Id; DoktorIlac aktarilacakilac = doktorilaclistesi.Find(delegate(DoktorIlac doktorilac) { return(doktorilac.Ilac.Id == IlacId); } ); try { aktarilacakilac.Delete(); } catch (Exception ex) { throw new Exception("Hata:" + ex.Message); } doktorilaclistesi.Remove(aktarilacakilac); DoktorIlacBind(); } else { MessageBox.Show("Listeden İlaç Seçmediniz"); } } catch (Exception) { MessageBox.Show("Çıkarılacak İlacı seçmelisiniz."); } }
private void DoktoraIlacAktar() { if (bstumilac.Current != null) { long IlacId = (bstumilac.Current as ilac).Id; ilac aktarilacakilac = IlacListesi.Find(delegate(ilac ilacentity) { return(ilacentity.Id == IlacId); } ); if (aktarilacakilac.Id > 0) { DoktorIlac doktorilac = new DoktorIlac(); doktorilac.Doktor.Id = Current.AktifDoktorId; doktorilac.Doktor = Current.AktifDoktor; doktorilac.Ilac.Id = aktarilacakilac.Id; doktorilac.Ilac = aktarilacakilac; doktorilac.Aktif = true; bool varmi = doktorilaclistesi.Exists(delegate(DoktorIlac dilac) { if (dilac.Ilac.Id == aktarilacakilac.Id) { return(true); } else { return(false); } } ); if (varmi) { MessageBox.Show("Bu ilac listede mevcut."); return; } try { doktorilac.Insert(); } catch (Exception ex) { throw new Exception("Hata:" + ex.Message); } doktorilaclistesi.Add(doktorilac); DoktorIlacBind(); } } else { MessageBox.Show("Doktor İlaç Listesine ilaç aktarmak için ilaç seçmediniz"); } }
private void ReceteyeIlacAktar(IlacAktarmaTipi aktarimtipi) { ilac aktarilacakilac = null; if (aktarimtipi == IlacAktarmaTipi.IlacListesindenAktar) { if (bstumilac.Current == null) { MessageBox.Show(" İlaç seçmediniz !"); return; } long IlacId = (bstumilac.Current as ilac).Id; aktarilacakilac = IlacListesi.Find(delegate(ilac ilc) { return(ilc.Id == IlacId); } ); } else if (aktarimtipi == IlacAktarmaTipi.DoktorIlacListesindenAktar) { if (bsdoktorilac.Current == null) { MessageBox.Show(" İlaç seçmediniz !"); return; } long IlacId = (bsdoktorilac.Current as DoktorIlac).Ilac.Id; DoktorIlac doktorilac = doktorilaclistesi.Find(delegate(DoktorIlac dilac) { return(dilac.Ilac.Id == IlacId); } ); aktarilacakilac = doktorilac.Ilac; } if (aktarilacakilac.Id > 0) { bool varmi = receteilaclistesi.Exists(delegate(Receteilac receteilacentity) { if (receteilacentity.Ilac.Id == aktarilacakilac.Id) { return(true); } else { return(false); } }); if (varmi) { MessageBox.Show("Bu İlaç listede mevcut "); return; } Receteilac receteilac = new Receteilac(); receteilac.Adet = Convert.ToInt16(edtadet.Text); receteilac.KullanimPeriyot = (myenum.ilacKullanimPeriyot)ucilacdozaj1.Deger; receteilac.KullanimSekli = (myenum.ilacKullanimSekli)ucilacKullanimSekli1.Deger; receteilac.Ilac.Id = aktarilacakilac.Id; receteilac.Ilac = aktarilacakilac; receteilac.Aktif = true; receteilac.MuayeneId = Current.AktifMuayeneId; receteilac.KullanimSekliAciklama = textBoxKullanimSekliAciklama.Text; receteilac.ilacDozAciklama = textBoxDozAciklama.Text; receteilac.Validate(); receteilaclistesi.Add(receteilac); ReceteIlacBind(); ucilacKullanimSekli1.Deger = 0; ucilacdozaj1.Deger = 0; edtadet.Value = 0; textBoxDozAciklama.Clear(); textBoxKullanimSekliAciklama.Clear(); } }