Exemple #1
0
        public object GetActiveTest(int id)
        {
            UrineTest test = (from q in db.UrineTest
                              where q.urtest_id == id
                              select q).FirstOrDefault();

            return(test);
        }
Exemple #2
0
 private void FillUrTest(UrineTest u)
 {
     if (protTB.Text.Trim() != "")
     {
         u.urtest_protein = Convert.ToDouble(protTB.Text.Replace('.', ','));
     }
     else
     {
         u.urtest_protein = null;
     }
     if (SugarTB.Text.Trim() != "")
     {
         u.urtest_sugar = SugarTB.Text;
     }
     else
     {
         u.urtest_sugar = "";
     }
     if (lminTB.Text.Trim() != "")
     {
         u.urtest_leumin = Convert.ToInt32(lminTB.Text.Replace('.', ','));
     }
     else
     {
         u.urtest_leumin = null;
     }
     if (lmaxTB.Text.Trim() != "")
     {
         u.urtest_leumax = Convert.ToInt32(lmaxTB.Text);
     }
     else
     {
         u.urtest_leumax = null;
     }
     if (erminTB.Text.Trim() != "")
     {
         u.urtest_ermin = Convert.ToInt32(erminTB.Text);
     }
     else
     {
         u.urtest_ermin = null;
     }
     if (ermaxTB.Text.Trim() != "")
     {
         u.urtest_ermax = Convert.ToInt32(ermaxTB.Text);
     }
     else
     {
         u.urtest_ermax = null;
     }
 }
Exemple #3
0
        public void UpdateTest(object o)
        {
            UrineTest b    = o as UrineTest;
            UrineTest oldb = (from q in db.UrineTest where q.urtest_id == b.urtest_id select q).FirstOrDefault();

            oldb.urtest_protein = b.urtest_protein;
            oldb.urtest_sugar   = b.urtest_sugar;
            oldb.urtest_leumin  = b.urtest_leumin;
            oldb.urtest_leumax  = b.urtest_leumax;
            oldb.urtest_ermin   = b.urtest_ermin;
            oldb.urtest_ermax   = b.urtest_ermax;
            ChangeStateToClosed(oldb.urtest_id);
            db.SaveChanges();
        }
Exemple #4
0
        public void PlanNewTest(DateTime date, int pid)
        {
            UrTest__Patient ur = new UrTest__Patient();

            ur.utp_state = (from q in db.State
                            where q.state_value == "заплановано"
                            select q.state_id).FirstOrDefault();
            ur.utp_date = date;
            UrineTest test = new UrineTest();

            db.UrineTest.Add(test);
            ur.utp_patid  = pid;
            ur.utp_testid = test.urtest_id;
            db.UrTest__Patient.Add(ur);
            db.SaveChanges();
        }
Exemple #5
0
        public int DeleteTest(int id)
        {
            UrTest__Patient ur = (from q in db.UrTest__Patient
                                  where (q.utp_id == id)
                                  select q).FirstOrDefault();
            int testid = ur.utp_testid ?? default(int);

            db.UrTest__Patient.Remove(ur);
            db.SaveChanges();
            UrineTest test = (from q in db.UrineTest
                              where q.urtest_id == testid
                              select q).FirstOrDefault();

            if (test != null)
            {
                db.UrineTest.Remove(test);
                db.SaveChanges();
            }
            return(testid);
        }
Exemple #6
0
        public override void Plan(DateTime date)
        {
            try
            {
                UrTest__Patient u    = new UrTest__Patient();
                UrineTest       test = new UrineTest();
                ctx.UrineTest.Add(test);

                u.utp_patid  = pat.p_id;
                u.utp_state  = (from c in ctx.State where (c.state_value == "заплановано") select c.state_id).FirstOrDefault();
                u.utp_date   = date.Date;
                u.utp_testid = test.urtest_id;
                ctx.UrTest__Patient.Add(u);
                ctx.SaveChanges();
                Renew();
            }
            catch
            {
                MessageBox.Show("Помилка при плануванні");
            }
        }
Exemple #7
0
        public UrinaTestForm(int testid, DateTime date, mode _m)
        {
            InitializeComponent();

            ctx  = new TubDataBaseEntities();
            m    = _m;
            test = testid;
            ur   = (from c in ctx.UrineTest where (c.urtest_id == testid) select c).FirstOrDefault();
            if (m == mode.Redact)
            {
                this.StatusL.Text = "Завершено " + date.ToShortDateString();
                LoadTest(testid);
            }
            else if (m == mode.Create)
            {
                this.StatusL.Text = "Закінчити тест за " + date.ToShortDateString();
            }
            else if (m == mode.Losed)
            {
                this.StatusL.Text = "Пропущений тест за " + date.ToShortDateString();
            }
        }
Exemple #8
0
 public ActionResult UpdateUrinaTest(UrineTest urina)
 {
     HelperSelector.get(model.ViewName).UpdateTest(urina);
     model.Single = null;
     return(redirect());
 }