Esempio n. 1
0
    /// <summary>
    /// Delete all the dependencies of this visit
    /// </summary>
    /// <param name="id">ID of the Visit</param>
    public static void DeleteDependencies(long id)
    {
        var ctx = new DataClassesDataContext();

        // Visit's dependencies are Prescription and LabOrder

        // delete all LabOrder
        var labOrders = from l in ctx.LabOrders
                        where l.VisitID == id
                        select l;

        foreach (var labOrder in labOrders)
        {
            LabOrderOperations.DeleteDependencies(labOrder.ID);
        }
        ctx.LabOrders.DeleteAllOnSubmit(labOrders);

        //delete all Prescription
        var prescriptions = from p in ctx.Prescriptions
                            where p.VisitID == id
                            select p;

        foreach (var prescription in prescriptions)
        {
            PrescriptionOperations.DeleteDependencies(prescription.ID);
        }
        ctx.Prescriptions.DeleteAllOnSubmit(prescriptions);

        //submit all changes
        ctx.SubmitChanges();
    }
    protected void PrescriptionDetailsFormView_ItemDeleting(object sender, FormViewDeleteEventArgs e)
    {
        System.Threading.Thread.Sleep(1000);

        // delete all this prescription's dependencies
        PrescriptionOperations.DeleteDependencies(long.Parse(e.Keys["ID"].ToString()));
    }
        public void PrescriptionInsertIntoDatabaseTest()
        {
            var po           = new PrescriptionOperations();
            var prescription = new Prescription()
            {
                PrescriptionId  = 1,
                DrugName        = "Crocin",
                DrugType        = "Tablet",
                Quantity        = 30,
                IntakeTimeFrame = "before Breakfast",
                NoOfDays        = 7,
                Disease         = "Fever"
            };

            //checking automation tests
            Assert.AreEqual(true, po.PrescriptionInsertIntoDatabase(prescription));
        }
 protected void PrescriptionFormView_ItemDeleting(object sender, FormViewDeleteEventArgs e)
 {
     // delete all this prescription's dependencies
     PrescriptionOperations.DeleteDependencies(long.Parse(e.Keys["ID"].ToString()));
 }
Esempio n. 5
0
        public bool Put([FromBody] Prescription prescription)
        {
            PrescriptionOperations prescriptionOperations = new PrescriptionOperations();

            return(prescriptionOperations.PrescriptionInsertIntoDatabase(prescription));
        }
Esempio n. 6
0
        public string Get()
        {
            PrescriptionOperations prescriptionOperations = new PrescriptionOperations();

            return(prescriptionOperations.GetAllPrescriptions());
        }
Esempio n. 7
0
        public string Get([FromUri] int paramOne)
        {
            PrescriptionOperations prescriptionOperations = new PrescriptionOperations();

            return(prescriptionOperations.GetPrescriptionfromDatabase(paramOne));
        }
        public void GetAllPrescriptionsTest()
        {
            var po = new PrescriptionOperations();

            Assert.AreEqual("", po.GetAllPrescriptions());
        }
        public void GetPrescriptionFromDatabaseTest()
        {
            var po = new PrescriptionOperations();

            Assert.AreEqual("", po.GetPrescriptionfromDatabase(1));
        }