public AnalizeBloodPageView(AnalizeBlood AnalizeBlood)
 {
     this.AnalizeBlood = AnalizeBlood;
     controller        = new AnalizeBloodsController();
     InitializeComponent();
     Loaded += AnalizeBloodPageView_LoadedUpdate;
 }
        private async void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var AnalizeBlood = new AnalizeBlood()
                {
                    Analizi = new Analizi()
                    {
                        Client       = pageClient.Input as Client,
                        Laborant     = pageLaborant.Input as Laborant,
                        IdAnalizType = HelpDb.IdTypeForBlood
                    }
                };

                AnalizeBlood.Blood                = float.Parse(pageBlood.Input);
                AnalizeBlood.Zhelezo              = float.Parse(pageZhelezo.Input);
                AnalizeBlood.Analizi.IdClient     = (pageClient.Input as Client).Id;
                AnalizeBlood.Analizi.Client       = null;
                AnalizeBlood.Analizi.IdLaborant   = (pageLaborant.Input as Laborant).Id;
                AnalizeBlood.Analizi.Laborant     = null;
                AnalizeBlood.Analizi.IdAnalizType = HelpDb.IdTypeForBlood;
                await Task.Run(() => controller.AddAnalizeBlood(AnalizeBlood));

                GoodClose();
            }
            catch (Exception ex)
            {
                HelpMessageBox.MessageBoxError(ex.Message, Title);
            }
        }
Esempio n. 3
0
 public void AddAnalizeBlood(AnalizeBlood AnalizeBlood)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.AnalizeBloods.Add(AnalizeBlood);
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Esempio n. 4
0
 public void DeleteAnalizeBlood(AnalizeBlood AnalizeBlood)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.Entry(AnalizeBlood.Analizi).State = EntityState.Deleted;
             db.Entry(AnalizeBlood).State         = EntityState.Deleted;
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Esempio n. 5
0
        private bool CheckSelected(out AnalizeBlood AnalizeBlood)
        {
            var selected = ClList.SelectedItem;

            if (selected == null)
            {
                HelpMessageBox.MessageBoxError("Объект не выбран");
                AnalizeBlood = null;
                return(false);
            }
            else
            {
                AnalizeBlood = selected as AnalizeBlood;
                return(true);
            }
        }