Exemplo n.º 1
0
        public void AddTest(List <TestsInOrder> listTests)
        {
            SessionFactory SF = new SessionFactory();

            SF.Init();
            SF.OpenSession();

            GenericDaoImpl <TestsInOrder, int> testDao       = new GenericDaoImpl <TestsInOrder, int>(SF.GetSession());
            GenericDaoImpl <Test, int>         testNameDao   = new GenericDaoImpl <Test, int>(SF.GetSession());
            GenericDaoImpl <TestStatus, int>   testStatusDao = new GenericDaoImpl <TestStatus, int>(SF.GetSession());

            Test       testName   = new Test();
            TestStatus testStatus = new TestStatus();

            foreach (TestsInOrder item in listTests)
            {
                testName   = testNameDao.Get(item.Test.ID_Test);
                testStatus = testStatusDao.Get(item.TestStatus.ID_TestStatus);

                item.Test       = testName;
                item.TestStatus = testStatus;
                item.Status     = 1;
                testDao.Save(item);
            }

            SF.CloseSession();
        }
Exemplo n.º 2
0
        public void UpdateTest(List <TestsInOrder> listTests)
        {
            SessionFactory SF = new SessionFactory();

            SF.Init();
            SF.OpenSession();

            GenericDaoImpl <TestsInOrder, int> testDao       = new GenericDaoImpl <TestsInOrder, int>(SF.GetSession());
            GenericDaoImpl <Test, int>         testNameDao   = new GenericDaoImpl <Test, int>(SF.GetSession());
            GenericDaoImpl <TestStatus, int>   testStatusDao = new GenericDaoImpl <TestStatus, int>(SF.GetSession());

            Test       testName   = new Test();
            TestStatus testStatus = new TestStatus();

            foreach (TestsInOrder item in listTests)
            {
                testName   = testNameDao.Get(item.Test.ID_Test);
                testStatus = testStatusDao.Get(item.TestStatus.ID_TestStatus);

                TestsInOrder tst = testDao.Get(item.ID_TestOrder);
                tst.DateStart  = item.DateStart;
                tst.Result     = item.Result;
                tst.Test       = testName;
                tst.TestStatus = testStatus;
                testDao.Save(tst);
            }

            SF.CloseSession();
        }
Exemplo n.º 3
0
        public void UpdateOrder(List <OrderOfPatient> listOrders)
        {
            SessionFactory SF = new SessionFactory();

            SF.Init();
            SF.OpenSession();

            GenericDaoImpl <OrderOfPatient, int> orderDao       = new GenericDaoImpl <OrderOfPatient, int>(SF.GetSession());
            GenericDaoImpl <OrderStatus, int>    orderStatusDao = new GenericDaoImpl <OrderStatus, int>(SF.GetSession());
            GenericDaoImpl <Patient, int>        patientDao     = new GenericDaoImpl <Patient, int>(SF.GetSession());
            GenericDaoImpl <Doctor, int>         doctorDao      = new GenericDaoImpl <Doctor, int>(SF.GetSession());

            OrderStatus orderStatus = new OrderStatus();
            Patient     patient     = new Patient();
            Doctor      doctor      = new Doctor();

            foreach (OrderOfPatient item in listOrders)
            {
                orderStatus = orderStatusDao.Get(item.OrderStatus.ID_OrderStatus);
                patient     = patientDao.Get(item.Patient.ID_Patient);
                doctor      = doctorDao.Get(item.Doctor.ID_Doctor);

                OrderOfPatient ord = orderDao.Get(item.ID_Order);
                ord.DateOrder   = item.DateOrder;
                ord.Symptoms    = item.Symptoms;
                ord.Patient     = patient;
                ord.Doctor      = doctor;
                ord.OrderStatus = orderStatus;

                orderDao.Save(ord);
            }

            SF.CloseSession();
        }
Exemplo n.º 4
0
        public void AddPatient(List <Patient> listPatients)
        {
            SessionFactory SF = new SessionFactory();

            SF.Init();
            SF.OpenSession();

            GenericDaoImpl <Patient, int> patientDao = new GenericDaoImpl <Patient, int>(SF.GetSession());
            GenericDaoImpl <Gender, int>  genderDao  = new GenericDaoImpl <Gender, int>(SF.GetSession());

            Gender male   = genderDao.Get(1);
            Gender female = genderDao.Get(2);

            foreach (Patient item in listPatients)
            {
                if (item.Gender.ID_Gender == male.ID_Gender)
                {
                    item.Gender = male;
                }
                else if (item.Gender.ID_Gender == female.ID_Gender)
                {
                    item.Gender = female;
                }
                item.Status = 1;
                patientDao.Save(item);
            }

            SF.CloseSession();
        }
Exemplo n.º 5
0
        public void UpdateSpeciment(List <SpecimentsInOrder> listSpeciments)
        {
            SessionFactory SF = new SessionFactory();

            SF.Init();
            SF.OpenSession();

            GenericDaoImpl <SpecimentsInOrder, int> specimentDao       = new GenericDaoImpl <SpecimentsInOrder, int>(SF.GetSession());
            GenericDaoImpl <OrderOfPatient, int>    orderDao           = new GenericDaoImpl <OrderOfPatient, int>(SF.GetSession());
            GenericDaoImpl <Speciment, int>         specimentNameDao   = new GenericDaoImpl <Speciment, int>(SF.GetSession());
            GenericDaoImpl <SpecimentStatus, int>   specimentStatusDao = new GenericDaoImpl <SpecimentStatus, int>(SF.GetSession());

            OrderOfPatient  order           = new OrderOfPatient();
            Speciment       specimentName   = new Speciment();
            SpecimentStatus specimentStatus = new SpecimentStatus();

            foreach (SpecimentsInOrder item in listSpeciments)
            {
                order           = orderDao.Get(item.Order.ID_Order);
                specimentName   = specimentNameDao.Get(item.Speciment.ID_Speciment);
                specimentStatus = specimentStatusDao.Get(item.SpecimentStatus.ID_SpecimentStatus);

                SpecimentsInOrder sp = specimentDao.Get(item.ID_SpecimentOrder);
                sp.DateOfTaking    = item.DateOfTaking;
                sp.Nurse           = item.Nurse;
                sp.Order           = order;
                sp.Speciment       = specimentName;
                sp.SpecimentStatus = specimentStatus;

                specimentDao.Save(sp);
            }

            SF.CloseSession();
        }
Exemplo n.º 6
0
        public void AddSpeciment(List <SpecimentsInOrder> listSpeciments)
        {
            SessionFactory SF = new SessionFactory();

            SF.Init();
            SF.OpenSession();

            GenericDaoImpl <SpecimentsInOrder, int> specimentDao       = new GenericDaoImpl <SpecimentsInOrder, int>(SF.GetSession());
            GenericDaoImpl <OrderOfPatient, int>    orderDao           = new GenericDaoImpl <OrderOfPatient, int>(SF.GetSession());
            GenericDaoImpl <Speciment, int>         specimentNameDao   = new GenericDaoImpl <Speciment, int>(SF.GetSession());
            GenericDaoImpl <SpecimentStatus, int>   specimentStatusDao = new GenericDaoImpl <SpecimentStatus, int>(SF.GetSession());

            OrderOfPatient  order           = new OrderOfPatient();
            Speciment       specimentName   = new Speciment();
            SpecimentStatus specimentStatus = new SpecimentStatus();

            foreach (SpecimentsInOrder item in listSpeciments)
            {
                order           = orderDao.Get(item.Order.ID_Order);
                specimentName   = specimentNameDao.Get(item.Speciment.ID_Speciment);
                specimentStatus = specimentStatusDao.Get(item.SpecimentStatus.ID_SpecimentStatus);

                item.Order           = order;
                item.Speciment       = specimentName;
                item.SpecimentStatus = specimentStatus;
                item.Status          = 1;
                specimentDao.Save(item);
            }

            SF.CloseSession();
        }
Exemplo n.º 7
0
        public int SaveRelative(Relative relative)
        {
            SessionFactory SF = new SessionFactory();

            SF.Init();
            SF.OpenSession();

            GenericDaoImpl <Relative, int> relativeDao = new GenericDaoImpl <Relative, int>(SF.GetSession());
            int id = (relativeDao.Save(relative)).ID_Relative;

            SF.CloseSession();
            return(id);
        }