Example #1
0
        private Treatment GetUpdatedTreatmentStatus(int treatmentID, int status)
        {
            Treatment oldTreatment = treatment;
            Treatment newTreatment = TreatmentFactory.Instance().CreateTreatment(treatmentID, oldTreatment.treatmentType, oldTreatment.operationRoom, oldTreatment.cage, oldTreatment.item,
                                                                                 oldTreatment.startTime, oldTreatment.endTime, oldTreatment.payed, oldTreatment.headline, oldTreatment.active, oldTreatment.animal, oldTreatment.employee, status);

            return(newTreatment);
        }
Example #2
0
        public void DeleteTreatment()
        {
            Treatment treatment = TreatmentFactory.Instance().CreateTreatment(treatmentType, operationRoom, cage, item, DateTime.Now, DateTime.Now, true, "", true, animal, employee, 0);

            TreatmentManager treatmentManager = new TreatmentManager();
            string           treatmentt       = treatmentManager.DeleteTreatment(treatmentID);

            Assert.AreNotEqual("OK", treatmentt);
        }
Example #3
0
        public void CreateTreatmentTestMethod()
        {
            Treatment treatment = TreatmentFactory.Instance().CreateTreatment(treatmentType, operationRoom, cage, item, DateTime.Now, DateTime.Now, true, "", true, animal, employee, 0);

            TreatmentManager treatmentManager = new TreatmentManager();
            Treatment        treatmentt       = treatmentManager.CreateTreatment(treatment);

            Assert.AreNotEqual(0, treatmentt.treatmentID);
            treatmentID = treatment.treatmentID;
        }
Example #4
0
        private List <MedicalRecord> GetMedicalRecordEntryList(Animal animal, SQLQueryResult sQLQueryResult)
        {
            List <MedicalRecord> entries = new List <MedicalRecord>();

            for (int i = 0; i < sQLQueryResult.dataTable.Rows.Count; i++)
            {
                string   entry           = (string)sQLQueryResult.dataTable.Rows[i]["Entry"];
                int      MedicalRecordID = (int)sQLQueryResult.dataTable.Rows[i]["MedicalRecordID"];
                int      TreatmentID     = (int)sQLQueryResult.dataTable.Rows[i]["TreatmentID"];
                DateTime StartTime       = (DateTime)sQLQueryResult.dataTable.Rows[i]["StartTime"];
                DateTime EndTime         = (DateTime)sQLQueryResult.dataTable.Rows[i]["EndTime"];
                bool     Payed           = (bool)sQLQueryResult.dataTable.Rows[i]["Payed"];
                string   Headline        = (string)sQLQueryResult.dataTable.Rows[i]["Headline"];
                bool     Active          = (bool)sQLQueryResult.dataTable.Rows[i]["Active"];
                int      Status          = (int)sQLQueryResult.dataTable.Rows[i]["Status"];

                Treatment treatment = TreatmentFactory.Instance().CreateTreatment(TreatmentID, null, null, null, null, StartTime, EndTime, Payed, Headline, Active, animal, null, Status);

                MedicalRecord medicalRecord = MedicalRecordFactory.Instance().CreateMedicalRecord(MedicalRecordID, entry, animal, treatment);
                entries.Add(medicalRecord);
            }
            return(entries);
        }
Example #5
0
        private List <Treatment> GetTreatmentList(SQLQueryResult sQLQueryResult)
        {
            List <Treatment> treatments = new List <Treatment>();

            for (int i = 0; i < sQLQueryResult.dataTable.Rows.Count; i++)
            {
                int           treatmentID;
                TreatmentType treatmentType;
                Employee      employee;
                Employee      animalEmployee = null;
                OperationRoom operationRoom;
                Cage          cage;
                Item          item;
                int           animalID;
                Title         title;


                if (sQLQueryResult.dataTable.Rows[i].IsNull("TreatmentID"))
                {
                    treatmentID = -1;
                }
                else
                {
                    treatmentID = (int)sQLQueryResult.dataTable.Rows[i]["TreatmentID"];
                }
                if (sQLQueryResult.dataTable.Rows[i].IsNull("TreatmentTypeID"))
                {
                    treatmentType = null;
                }
                else
                {
                    int    treatmentTypeID   = (int)sQLQueryResult.dataTable.Rows[i]["TreatmentTypeID"];
                    string treatmentTypeName = (string)sQLQueryResult.dataTable.Rows[i]["Name"];

                    TreatmentType newTreatmentType = TreatmentTypeFactory.Instance().CreateTreatmentType(treatmentTypeID, treatmentTypeName);

                    treatmentType = newTreatmentType;
                }
                if (sQLQueryResult.dataTable.Rows[i].IsNull("OperationRoomID"))
                {
                    operationRoom = null;
                }
                else
                {
                    int operationRoomID = (int)sQLQueryResult.dataTable.Rows[i]["OperationRoomID"];

                    operationRoom = OperationRoomFactory.Instance().CreateOperationRoom(operationRoomID);
                }

                if (sQLQueryResult.dataTable.Rows[i].IsNull("CageID"))
                {
                    cage = null;
                }
                else
                {
                    int    cageID      = (int)sQLQueryResult.dataTable.Rows[i]["CageID"];
                    int    speciesID   = (int)sQLQueryResult.dataTable.Rows[i]["SpeciesID"];
                    string speciesName = (string)sQLQueryResult.dataTable.Rows[i]["SpeciesName"];

                    Species species = SpeciesFactory.Instance().CreateSpecies(speciesID, speciesName);

                    cage = CageFactory.Instance().CreateCage(cageID, species);
                }


                if (sQLQueryResult.dataTable.Rows[i].IsNull("ItemID"))
                {
                    item = null;
                }
                else
                {
                    int     itemID       = (int)sQLQueryResult.dataTable.Rows[i]["ItemID"];
                    string  name         = (string)sQLQueryResult.dataTable.Rows[i]["ItemName"];
                    decimal price        = (decimal)sQLQueryResult.dataTable.Rows[i]["Price"];
                    decimal costPrice    = (decimal)sQLQueryResult.dataTable.Rows[i]["CostPrice"];
                    int     amount       = (int)sQLQueryResult.dataTable.Rows[i]["Amount"];
                    bool    prescription = (bool)sQLQueryResult.dataTable.Rows[i]["Prescription"];
                    bool    treatment    = (bool)sQLQueryResult.dataTable.Rows[i]["ItemTreatment"];
                    bool    itemActive   = (bool)sQLQueryResult.dataTable.Rows[i]["ItemActive"];

                    item = ItemFactory.Instance().CreateItem(itemID, name, amount, price, costPrice, prescription, treatment, itemActive);
                }

                if (sQLQueryResult.dataTable.Rows[i].IsNull("EmployeeID"))
                {
                    employee = null;
                }
                else
                {
                    int    employeeID = (int)sQLQueryResult.dataTable.Rows[i]["EmployeeID"];
                    string name       = (string)sQLQueryResult.dataTable.Rows[i]["Employeename"];
                    int    titleID    = (int)sQLQueryResult.dataTable.Rows[i]["TitleID"];
                    string titleName  = (string)sQLQueryResult.dataTable.Rows[i]["TitleName"];

                    title    = TitleFactory.Instance().CreateTitle(titleName, titleID);
                    employee = EmployeeFactory.Instance().CreateEmployee(employeeID, name, true, title);
                }

                animalID = (int)sQLQueryResult.dataTable.Rows[i]["AnimalID"];
                if (!sQLQueryResult.dataTable.Rows[i].IsNull("AnimalEmployeeID"))
                {
                    int    animalTitleID   = (int)sQLQueryResult.dataTable.Rows[i]["AnimalEmployeeTitleID"];
                    string animalTitleName = (string)sQLQueryResult.dataTable.Rows[i]["AnimalEmployeeTitle"];

                    Title animalEmployeeTitle = TitleFactory.Instance().CreateTitle(animalTitleName, animalTitleID);

                    int    animalEmployeeID   = (int)sQLQueryResult.dataTable.Rows[i]["AnimalEmployeeID"];
                    string animalEmployeeName = (string)sQLQueryResult.dataTable.Rows[i]["AnimalEmployeeName"];

                    bool animalEmployeeActive = (bool)sQLQueryResult.dataTable.Rows[i]["AnimalEmployeeActive"];


                    animalEmployee = EmployeeFactory.Instance().CreateEmployee(animalEmployeeID, animalEmployeeName, animalEmployeeActive, animalEmployeeTitle);
                }

                int    animalSpeciesID   = (int)sQLQueryResult.dataTable.Rows[i]["AnimalSpeciesID"];
                string animalSpeciesName = (string)sQLQueryResult.dataTable.Rows[i]["AnimalSpeciesName"];

                Species animalSpecies = SpeciesFactory.Instance().CreateSpecies(animalSpeciesID, animalSpeciesName);

                int    customerID      = (int)sQLQueryResult.dataTable.Rows[i]["CustomerID"];
                string customerName    = (string)sQLQueryResult.dataTable.Rows[i]["CustomerName"];
                string customerAddress = (string)sQLQueryResult.dataTable.Rows[i]["Adress"];
                string customerPhone   = (string)sQLQueryResult.dataTable.Rows[i]["Phone"];
                string customerEmail   = (string)sQLQueryResult.dataTable.Rows[i]["Email"];
                bool   customerActive  = (bool)sQLQueryResult.dataTable.Rows[i]["CustomerActive"];

                Customer customer = CustomerFactory.Instance().CreateCustomer(customerID, customerName, customerAddress, customerPhone, customerEmail, customerActive, 0);


                string   animalName     = (string)sQLQueryResult.dataTable.Rows[i]["AnimalName"];
                DateTime animalBirthday = (DateTime)sQLQueryResult.dataTable.Rows[i]["BirthYear"];
                bool     animalGender   = (bool)sQLQueryResult.dataTable.Rows[i]["Gender"];
                double   animalWeight   = Convert.ToDouble((decimal)sQLQueryResult.dataTable.Rows[i]["Weight"]);
                bool     animalActive   = (bool)sQLQueryResult.dataTable.Rows[i]["AnimalActive"];

                Animal animal = AnimalFactory.Instance().CreateAnimal(customer, animalID, animalName, animalBirthday, animalSpecies, animalWeight, animalGender, animalEmployee, animalActive);

                if (sQLQueryResult.dataTable.Rows[i].IsNull("AnimalID"))
                {
                    animalID = -1;
                }
                else
                {
                    animalID = (int)sQLQueryResult.dataTable.Rows[i]["AnimalID"];
                }
                DateTime startTime = (DateTime)sQLQueryResult.dataTable.Rows[i]["StartTime"];
                DateTime endTime   = (DateTime)sQLQueryResult.dataTable.Rows[i]["EndTime"];
                bool     payed     = (bool)sQLQueryResult.dataTable.Rows[i]["Payed"];
                string   headline  = (string)sQLQueryResult.dataTable.Rows[i]["Headline"];
                bool     active    = (bool)sQLQueryResult.dataTable.Rows[i]["Active"];
                int      status    = (int)sQLQueryResult.dataTable.Rows[i]["Status"];

                treatments.Add(TreatmentFactory.Instance().CreateTreatment(treatmentID, treatmentType, operationRoom, cage, item, startTime, endTime, payed, headline, active, animal, employee, status));
            }
            return(treatments);
        }