private List <Hospital> ListHospital()
 {
     using (NUHRandomizerEntities cxt = new NUHRandomizerEntities())
     {
         return(cxt.Hospitals.ToList());
     }
 }
 protected List <Patient> ListNUH()
 {
     using (NUHRandomizerEntities cxt = new NUHRandomizerEntities())
     {
         return(cxt.Patients.Where(x => x.Hospital.HospitalShortName == "NUH").ToList());
     }
 }
 protected List <Patient> ListNUHLowS()
 {
     using (NUHRandomizerEntities cxt = new NUHRandomizerEntities())
     {
         return(cxt.Patients.Where(x => x.Hospital.HospitalShortName == "NUH" && x.ResearchArmsId == 4).ToList());
     }
 }
 protected List <Patient> ListPatientsLowS()
 {
     using (NUHRandomizerEntities cxt = new NUHRandomizerEntities())
     {
         return(cxt.Patients.Where(x => x.ResearchArmsId == 4).ToList());
     }
 }
 protected List <Patient> ListPatients()
 {
     using (NUHRandomizerEntities cxt = new NUHRandomizerEntities())
     {
         return(cxt.Patients.ToList());
     }
 }
Exemple #6
0
 private void BindddlResearchArm()
 {
     using (NUHRandomizerEntities cxt = new NUHRandomizerEntities())
     {
         ddlQhbsag.DataSource     = cxt.ResearchArms.GroupBy(x => x.Strata).Select(x => x.FirstOrDefault()).ToList();
         ddlQhbsag.DataTextField  = "Strata";
         ddlQhbsag.DataValueField = "id";
         ddlQhbsag.SelectedIndex  = 0;
         ddlQhbsag.DataBind();
     }
 }
        //protected void ddlARS_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    using (NUHRandomizerEntities cxt = new NUHRandomizerEntities())
        //    {
        //        if(ddlResearchArm.SelectedIndex != 0)
        //        {
        //            int researchArmId = Convert.ToInt32(ddlResearchArm.SelectedValue);
        //            List<Patient> list = cxt.Patients.Where(x => x.ResearchArmsId == researchArmId).ToList();
        //            int id2 = Convert.ToInt32(ddlARS.SelectedValue);
        //            if (id2 == 1 || id2 == 3)
        //            {
        //                gdvPatient.DataSource = list.Where(x => x.ResearchArmsId == 1 || x.ResearchArmsId == 3).ToList();
        //            }
        //            else if (id2 == 2 || id2 == 4)
        //            {
        //                gdvPatient.DataSource = list.Where(x => x.ResearchArmsId == 2 || x.ResearchArmsId == 4).ToList();
        //            }
        //        }
        //        else
        //        {
        //            int id = Convert.ToInt32(ddlARS.SelectedValue);
        //            if (id == 1 || id == 3)
        //            {
        //                gdvPatient.DataSource = cxt.Patients.Where(x => x.ResearchArmsId == 1 || x.ResearchArmsId == 3).ToList();
        //            }
        //            else if (id == 2 || id == 4)
        //            {
        //                gdvPatient.DataSource = cxt.Patients.Where(x => x.ResearchArmsId == 2 || x.ResearchArmsId == 4).ToList();
        //            }
        //        }

        //        gdvPatient.DataBind();
        //    }
        //    btnClear.Visible = true;
        //}

        // Drop Down List for Hospitals
        private void BindddlHospital()
        {
            using (NUHRandomizerEntities cxt = new NUHRandomizerEntities())
            {
                ddlHospital.DataSource     = cxt.Hospitals.ToList();
                ddlHospital.DataTextField  = "HospitalShortName";
                ddlHospital.DataValueField = "id";
                ddlHospital.SelectedIndex  = 0;
                ddlHospital.DataBind();
            }
        }
Exemple #8
0
        private void PopulatePatient()
        {
            var user = Context.GetOwinContext().GetUserManager <ApplicationUserManager>()
                       .FindById(User.Identity.GetUserId());

            using (NUHRandomizerEntities cxt = new NUHRandomizerEntities())
            {
                gdvPatients.DataSource = cxt.Patients.Where(x => x.HospitalId == user.HospitalId).ToList();
                gdvPatients.DataBind();
            }
        }
Exemple #9
0
 protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         if ((e.Row.RowState & DataControlRowState.Edit) > 0)
         {
             NUHRandomizerEntities cxt       = new NUHRandomizerEntities();
             DropDownList          ddlStatus = (e.Row.FindControl("ddlStatus") as DropDownList);
             ddlStatus.DataSource     = cxt.RecruitmentStatus.ToList();
             ddlStatus.DataTextField  = "Status";
             ddlStatus.DataValueField = "Id";
             ddlStatus.DataBind();
         }
     }
 }
Exemple #10
0
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            NUHRandomizerEntities cxt = new NUHRandomizerEntities();
            GridViewRow           row = gdvPatients.Rows[e.RowIndex];

            int    status = Convert.ToInt32(((row.FindControl("ddlStatus") as DropDownList).SelectedValue));
            string remark = (row.FindControl("txtRemark") as TextBox).Text;

            int patient = Convert.ToInt32(gdvPatients.DataKeys[e.RowIndex].Value.ToString());
            var result  = cxt.Patients.SingleOrDefault(x => x.Id == patient);

            if (result != null)
            {
                result.RecruitStatusId = status;
                result.Remarks         = remark;
                cxt.SaveChanges();
            }

            gdvPatients.EditIndex = -1;
            PopulatePatient();
        }