public JsonResult PId(string id)
        {
            var pId     = int.Parse(id);
            var context = new PatientDataContext();
            var patient = context.PatientTables.FirstOrDefault(p => p.PatientID == pId);

            if (patient == null)
            {
                pId = context.PatientTables.Max(p => p.PatientID) + 1;
                var data = new
                {
                    PatientID      = pId,
                    PatientName    = string.Empty,
                    PatientContact = 0
                };
                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var data = new
                {
                    patient.PatientID,
                    patient.PatientName,
                    patient.PatientContact
                };
                return(Json(data, JsonRequestBehavior.AllowGet));
            }
        }
Example #2
0
    protected void btnSavePatient_Click(object sender, EventArgs e)
    {
        int patientId                = 0;
        PatientInformation pi        = new PatientInformation();
        PatientDataContext patientDC = new PatientDataContext(WebConfigurationManager.ConnectionStrings["MyTherapistDatabaseConnectionString"].ConnectionString);

        PatientInformationTableManager patientTableMgr = new PatientInformationTableManager();

        DatabaseObjects.Patient patientInformation = new DatabaseObjects.Patient();

        patientInformation.Id = 0;

        if ((Session["PatientID"] != null) && (Int32.TryParse(Session["PatientID"].ToString(), out patientId)))
        {
            patientInformation.Id = patientId;
        }

        patientInformation.FirstName   = txtboxFirstName.Text;
        patientInformation.LastName    = txtboxLastName.Text;
        patientInformation.Birthday    = String.Format("{0}/{1}/{2} 00:00:00", datepickerMonth.SelectedValue, datepickerDay.SelectedValue, datepickerYear.SelectedValue);
        patientInformation.PhoneNumber = txtboxPhone.Text;
        patientInformation.Email       = txtboxEmailAddress.Text;

        patientTableMgr.Update(patientInformation);

        if (patientCareSaved != null)
        {
            patientCareSaved(this, new EventArgs());
        }
    }
        public JsonResult Fees(string id)
        {
            var docId   = int.Parse(id);
            var context = new PatientDataContext();
            var doc     = context.DoctorTables.FirstOrDefault(d => d.DoctorID == docId);

            return(Json(doc.Fees, JsonRequestBehavior.AllowGet));
        }
        public ActionResult NewPatient(PatientTable patient)
        {
            var context = new PatientDataContext();

            context.PatientTables.InsertOnSubmit(patient);
            context.SubmitChanges();
            return(RedirectToAction("Dashboard"));
        }
Example #5
0
 public PatientInformationTableManager()
 {
     //
     // TODO: Add constructor logic here
     //
     pi        = new PatientInformation();
     patientDC = new PatientDataContext(WebConfigurationManager.ConnectionStrings["MyTherapistDatabaseConnectionString"].ConnectionString);
     dataEncryptionAlgorithm = new MyTherapistEncryption.SecurityController();
 }
Example #6
0
        public void Delete(Patient patient)
        {
            PatientDataContext patientDC       = new PatientDataContext(WebConfigurationManager.ConnectionStrings["MyTherapistDatabaseConnectionString"].ConnectionString);
            PatientInformation patientToDelete = new PatientInformation();


            patientToDelete = patientDC.PatientInformations.Single(patientRecord => patientRecord.Id == patient.Id);
            patientDC.PatientInformations.DeleteOnSubmit(patientToDelete);
            patientDC.SubmitChanges();
        }
        public JsonResult FindDoctors(string id)
        {
            var context = new PatientDataContext();
            var docs    = from doc in context.DoctorTables
                          where doc.Speciality == id
                          select new
            {
                doc.DoctorID,
                doc.Doctor,
                doc.Fees
            };

            return(Json(docs.ToList(), JsonRequestBehavior.AllowGet));
        }
Example #8
0
        public List <PatientDetails> GetAllPatients(string id)
        {
            var pId     = int.Parse(id);
            var context = new PatientDataContext();
            var list    = from p in context.PatientTables
                          where p.PatientID == pId
                          orderby p.EntryId descending
                          select new PatientDetails
            {
                PatientID = p.PatientID,
                Name      = p.PatientName,
                Disease   = p.Disease,
                Doctor    = p.DoctorTable.Doctor,
                Amount    = p.Amount
            };

            return(list.ToList());
        }
    protected void btnDeletePatient_Click(object sender, EventArgs e)
    {
        PatientDataContext patientDC       = new PatientDataContext("Data Source = (LocalDB)\\MSSQLLocalDB; AttachDbFilename = C:\\SoftwareDevelopmentProjects\\WebProjects\\myTherapist\\myTherapist\\App_Data\\myTherapist.mdf; Integrated Security = True");
        PatientInformation patientToDelete = new PatientInformation();

        PatientAppointmentInfomationDataContext patientAppointmentInformationDC       = new PatientAppointmentInfomationDataContext("Data Source = (LocalDB)\\MSSQLLocalDB; AttachDbFilename = C:\\SoftwareDevelopmentProjects\\WebProjects\\myTherapist\\myTherapist\\App_Data\\myTherapist.mdf; Integrated Security = True");
        PatientAppointmentInformation           patientAppointmentInformationToDelete = new PatientAppointmentInformation();

        Int32 patientId = 0;

        if (Session[CommonDefinitions.CommonDefinitions.PATIENT_ID] != null)
        {
            if (Session[CommonDefinitions.CommonDefinitions.DELETE_PATIENT_WARNING] == null)
            {
                lblWarningText.Text      = "Click Delete again to confirm this action.";
                lblWarningText.ForeColor = System.Drawing.Color.Red;
                lblWarningText.Visible   = true;
                Session[CommonDefinitions.CommonDefinitions.DELETE_PATIENT_WARNING] = "yes";
            }
            else
            {
                if (Int32.TryParse(Session[CommonDefinitions.CommonDefinitions.PATIENT_ID].ToString(), out patientId))
                {
                    Session[CommonDefinitions.CommonDefinitions.DELETE_PATIENT_WARNING] = null;

                    PatientInformationTableManager patientTableMgr = new PatientInformationTableManager();
                    Patient patientInfo = new Patient();
                    patientInfo.Id = patientId;
                    patientTableMgr.Delete(patientInfo);


                    lblWarningText.Visible = false;

                    PatientListing1.LoadGrid();
                }
            }
        }
        else
        {
            lblWarningText.Visible   = true;
            lblWarningText.Text      = "Select a patient to delete.";
            lblWarningText.ForeColor = System.Drawing.Color.Red;
        }
    }
Example #10
0
 public PatientController(PatientDataContext db)
 {
     _db = db;
 }
 public CounterController(PatientDataContext db)
 {
     _db = db;
 }
Example #12
0
 public RepositoryWrapper(PatientDataContext context)
 {
     this.context = context;
 }
Example #13
0
 public ReferralStatesController(PatientDataContext context)
 {
     _context = context;
 }