public static void RemovePrescription(DoctorPrescription _prescription)
 {
     using (SQLiteConnection conn = new SQLiteConnection(database))
     {
         conn.CreateTable <DoctorPrescription>();
         var prescription = conn.Table <DoctorPrescription>().Where(j => j.PrescriptionMedication == _prescription.PrescriptionMedication).FirstOrDefault();
     }
 }
 public static void InsertPrescription(DoctorPrescription prescription)
 {
     using (SQLiteConnection conn = new SQLiteConnection(database))
     {
         conn.CreateTable <DoctorPrescription>();
         conn.Insert(prescription);
     }
 }
 public static DoctorPrescription QuerySinglePrescription(DoctorPrescription _prescriptionName)
 {
     using (SQLiteConnection conn = new SQLiteConnection(database))
     {
         conn.CreateTable <DoctorPrescription>();
         var prescription = conn.Table <DoctorPrescription>().Where(j => j.PrescriptionMedication == _prescriptionName.PrescriptionMedication).FirstOrDefault();
         return(prescription);
     }
 }
 private void AddPrescriptionAsync(DoctorPrescription arg)
 {
     PrescribedMedication.Add(new DoctorPrescription
     {
         DatePrescribed         = arg.DatePrescribed,
         MedicationAddedNotes   = arg.MedicationAddedNotes,
         MedicationDosage       = arg.MedicationDosage,
         MedicationName         = arg.MedicationName,
         MedicationInstructions = arg.MedicationInstructions,
         MedicationType         = arg.MedicationType,
         TimePrescribed         = arg.TimePrescribed
     });
 }
Example #5
0
        public ActionResult Index(DoctorPrescription doctorPrescription)
        {
            var user  = Session["User"] as User;
            var rowId = db.DoctorPrescriptions.Count();

            if (user != null && user.OccupationsId == 1 && user.ProfessionId == 3)
            {
                string patientName = doctorPrescription.PatientName;
                string patientAge  = doctorPrescription.PatientAge;
                string visitedDate = DateTime.Today.ToString("dd/M/yyyy", CultureInfo.InvariantCulture);
                int?   genderId    = doctorPrescription.GenderId;
                int    doctorId    = user.Id;

                char[] charsToTrim = { '/', ' ', '-' };
                string patientId   = (rowId + 1) + "11" + (rowId + 1);


                DoctorPrescription prescription = new DoctorPrescription()
                {
                    PatientId   = patientId,
                    PatientName = patientName,
                    PatientAge  = patientAge,
                    VisitedDate = visitedDate,
                    DoctorId    = doctorId,
                    GenderId    = genderId
                };
                db.DoctorPrescriptions.Add(prescription);
                var rowAffected = db.SaveChanges();

                if (rowAffected > 0)
                {
                    var id             = db.DoctorPrescriptions.SingleOrDefault(c => c.PatientId == patientId);
                    int prescriptionId = id.Id;
                    return(RedirectToAction("AddDrugs", new { prescriptionId = prescriptionId }));
                }
                else
                {
                    ViewBag.message = "Information Not Save . Please try again !!";
                    return(View());
                }
            }

            return(null);
        }