Beispiel #1
0
    protected void Insert_Click(object sender, EventArgs e)
    {
        using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
        {
            try
            {
                Physician__Patient relation = new Physician__Patient();
                relation.CP_ID = cpid;
                relation.P_ID  = pid;

                relation.UpdatedBy      = Profile.UserName;
                relation.UpdateDateTime = DateTime.Now;
                relation.UpdateUserName = Profile.Name;

                myEntities.AddToPhysician__Patient(relation);
                myEntities.SaveChanges();
            }
            catch (Exception ex)
            {
                Notification.Text = ex.Message;
            }
        }

        Response.Redirect(String.Format("~/Hospital/PatientInfo/Physicians.aspx?PID={0}", RegID.Text));
    }
Beispiel #2
0
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                try
                {
                    int did  = Convert.ToInt32(((Literal)e.Item.FindControl("DID")).Text);
                    var dept = from r in myEntities.Hospital__Department
                               where (r.D_ID == did && r.H_ID == hid)
                               select r;

                    myEntities.DeleteObject(dept.Single());

                    myEntities.SaveChanges();
                }
                catch (Exception ex)
                {
                    notify = true;
                    note   = ex.Message;
                }
            }

            Response.Redirect("~/Hospital/Management/Departments.aspx");
        }
    }
Beispiel #3
0
    protected void PhSearch_Click(object sender, EventArgs e)
    {
        using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
        {
            var hid = (from r in myEntities.Hospital__Staff
                       where r.Staff_ID == Profile.UserName
                       select r.H_ID).SingleOrDefault();

            cpid = (from r in myEntities.Hospital__Physician
                    where (r.CP_ID == PhSearchBox.Text && r.H_ID == hid)
                    select r.CP_ID).SingleOrDefault();

            if (cpid != null)
            {
                Result.Text          = "ID: " + cpid + "\tName: " + Profile.GetProfile(cpid).Name;
                ResultPanel.Visible  = true;
                Notification.Visible = false;
            }
            else
            {
                Notification.Text = "Physician with ID: " + PhSearch.Text + " does not exist, or is not " +
                                    "attached to this hospital.";
                Notification.Visible = true;
            }
        }
    }
Beispiel #4
0
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
        {
            try
            {
                if (e.CommandName == "Delete")
                {
                    string             cp_id = ((Literal)e.Item.FindControl("CPID")).Text;
                    Physician__Patient cp    = (from r in myEntities.Physician__Patient
                                                where (r.CP_ID == cp_id && r.P_ID == pid)
                                                select r).SingleOrDefault();
                    myEntities.DeleteObject(cp);
                    myEntities.SaveChanges();
                }

                Response.Redirect(String.Format("~/Hospital/PatientInfo/Physicians.aspx?PID={0}", pid));
            }
            catch (Exception ex)
            {
                //notify = true;
                //note = ex.Message;
            }
        }
    }
Beispiel #5
0
    protected void Insert_Click(object sender, EventArgs e)
    {
        using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
        {
            try
            {
                Hospital__Physician relation = new Hospital__Physician();
                relation.CP_ID = cpid;
                relation.H_ID  = hid;

                relation.UpdatedBy      = Profile.UserName;
                relation.UpdateDateTime = DateTime.Now;
                relation.UpdateUserName = Profile.Name;

                myEntities.AddToHospital__Physician(relation);
                myEntities.SaveChanges();
            }
            catch (Exception ex)
            {
                Notification.Text = ex.Message;
            }
        }

        Response.Redirect("~/Hospital/Management/Physicians.aspx");
    }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (!User.IsInRole("Administrator") && !User.IsInRole("Hospital Superuser") && !User.IsInRole("Hospital Management"))
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
                {
                    hid = (from r in myEntities.Hospital__Staff
                           where r.Staff_ID == Profile.UserName
                           select r.H_ID).SingleOrDefault();

                    if (hid == null)
                    {
                        hid = Profile.UserName;
                    }
                }
            }

            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                Repeater1.DataSource = from r in myEntities.Hospital__Physician
                                       join cp in myEntities.Physician__Profile on r.CP_ID equals cp.Physician_ID
                                       where r.H_ID == hid
                                       orderby r.CP_ID ascending
                                       select new { r.CP_ID, cp.Name, r.Unit };
                Repeater1.DataBind();
            }
        }
    }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        pid = Request.QueryString.Get("PID");
        if (!Page.IsPostBack && pid != null)
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                // Select patient based on registration id
                var p = (from r in myEntities.Patient__Profile
                         where r.Registration_ID == pid
                         select r).SingleOrDefault();

                string hid = (from r in myEntities.Hospital__Staff
                              where r.Staff_ID == Profile.UserName
                              select r.H_ID).SingleOrDefault();

                if (p != null && p.H_ID == hid)
                {
                    RegID.Text = pid;
                    PName.Text = p.PatientName;
                    PBed.Text  = (p.CurrentBedNo == null) ? "Unoccupied" : p.CurrentBedNo;

                    MultiView1.ActiveViewIndex = 0;

                    Diagnosis.Text = p.Diagnosis;
                }
                else
                {
                    MultiView1.ActiveViewIndex = 1;
                }
            }
        }
    }
Beispiel #8
0
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
        {
            try
            {
                string cp_id           = ((Literal)e.Item.FindControl("CPID")).Text;
                Hospital__Physician cp = (from r in myEntities.Hospital__Physician
                                          where r.CP_ID == cp_id && r.H_ID == hid
                                          select r).SingleOrDefault();

                switch (e.CommandName)
                {
                case "Delete":
                    myEntities.DeleteObject(cp);
                    myEntities.SaveChanges();
                    break;

                case "Save":
                    cp.Unit = ((TextBox)e.Item.FindControl("CPUnit")).Text;
                    myEntities.SaveChanges();
                    break;
                }

                Response.Redirect("~/Hospital/Management/Physicians.aspx");
            }
            catch (Exception ex)
            {
                //notify = true;
                //note = ex.Message;
            }
        }
    }
Beispiel #9
0
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                try
                {
                    string bed  = ((Literal)e.Item.FindControl("Bed")).Text;
                    var    beds = (from r in myEntities.Hospital__Bed
                                   where (r.H_ID == hid && r.BedNo == bed)
                                   select r).Single();

                    if (beds.Occupied == false)
                    {
                        myEntities.DeleteObject(beds);
                    }

                    myEntities.SaveChanges();
                }
                catch (Exception ex)
                {
                    //notify = true;
                    //note = ex.Message;
                }
            }

            Response.Redirect("~/Hospital/Management/Beds.aspx");
        }
    }
Beispiel #10
0
    protected void Insert_Click(object source, EventArgs e)
    {
        using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
        {
            try
            {
                Hospital__Department relation = new Hospital__Department();
                relation.D_ID = Convert.ToInt32(DSearchList.SelectedValue);
                relation.H_ID = hid;

                relation.UpdatedBy      = Profile.UserName;
                relation.UpdateDateTime = DateTime.Now;
                relation.UpdateUserName = Profile.Name;

                myEntities.AddToHospital__Department(relation);
                myEntities.SaveChanges();
            }
            catch (Exception ex)
            {
                notify = true;
                note   = ex.Message;
            }
        }

        Response.Redirect("~/Hospital/Management/Departments.aspx");
    }
Beispiel #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (!User.IsInRole("Administrator") && !User.IsInRole("Hospital Superuser") && !User.IsInRole("Hospital Management"))
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
                {
                    hid = (from r in myEntities.Hospital__Staff
                           where r.Staff_ID == Profile.UserName
                           select r.H_ID).SingleOrDefault();

                    if (hid == null)
                    {
                        hid = Profile.UserName;
                    }
                }
            }

            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                // Select hospital profile by ID
                var h = (from r in myEntities.Hospital__Profile
                         where r.Hospital_ID == hid
                         select r).SingleOrDefault();

                // Initialize form from database
                HospitalID.Text    = h.Hospital_ID;
                Name.Text          = h.HospitalName;
                SetLogo.Visible    = String.IsNullOrEmpty(h.LogoUrl);
                DeleteLogo.Visible = !String.IsNullOrEmpty(h.LogoUrl);
                Logo.ImageUrl      = h.LogoUrl;
                ESTD.Text          = h.ESTD.ToString();
                Website.Text       = h.Website;
                Email.Text         = h.Email;
                Address.Text       = h.Address;
                City.Text          = h.City;
                Pincode.Text       = h.Pincode;
                State.Text         = h.State;
                Country.Text       = h.Country;
                Phone1.Text        = h.Phone1;
                Phone2.Text        = h.Phone2;
                Phone3.Text        = h.Phone3;
                Phone4.Text        = h.Phone4;
                Fax.Text           = h.Fax;
            }
        }
    }
Beispiel #12
0
    protected void Save_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                Hospital__Staff profile;
                if (sid != null)
                {
                    profile = (from r in myEntities.Hospital__Staff
                               where r.Staff_ID == sid
                               select r).SingleOrDefault();

                    if (profile != null)
                    {
                        // Update profile information
                        profile.StaffName     = Name.Text;
                        profile.PhotoURL      = Photo.ImageUrl;
                        profile.Designation   = Designation.Text;
                        profile.Qualification = Qualification.Text;
                        profile.RelevantInfo  = Info.Text;
                        profile.Address       = Address.Text;
                        profile.State         = State.Text;
                        profile.Country       = Country.Text;
                        profile.Pincode       = Pincode.Text;
                        profile.Phone1        = Contact1.Text;
                        profile.Phone2        = Contact2.Text;
                        profile.Email         = Email.Text;

                        profile.UpdateDateTime = DateTime.Now;
                        profile.UpdatedBy      = Profile.UserName;
                        profile.UpdateUserName = Profile.Name;
                        myEntities.SaveChanges();

                        //Notification.Text = "Changes saved successfully.";
                        //System.Threading.Thread.Sleep(5000);
                        //Notification.Text = null;
                    }
                    else
                    {
                        MultiView1.ActiveViewIndex = 1;
                    }
                }
                else
                {
                    MultiView1.ActiveViewIndex = 1;
                }
            }
        }

        Response.Redirect(String.Format("~/Hospital/Management/StaffProfile.aspx?SID={0}", StfID.Text));
    }
Beispiel #13
0
    protected void Search_Click(object sender, EventArgs e)
    {
        string PID = SearchBox.Text;

        if (SearchBy.SelectedIndex == 1)
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                PID = (from r in myEntities.Patient__Profile
                       where r.CurrentBedNo == PID
                       select r.Registration_ID).SingleOrDefault();
            }
        }

        Response.Redirect(String.Format("~/Hospital/PatientInfo/Physicians.aspx?PID={0}", PID));
    }
Beispiel #14
0
    protected void Search_Click(object sender, EventArgs e)
    {
        string SID = SearchBox.Text;

        if (SearchBy.SelectedIndex == 1)
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                SID = (from r in myEntities.Hospital__Staff
                       where r.StaffName.Contains(SID)
                       select r.Staff_ID).FirstOrDefault();
            }
        }

        Response.Redirect(String.Format("~/Hospital/Management/StaffProfile.aspx?SID={0}", SID));
    }
Beispiel #15
0
    protected void Search_Click(object sender, EventArgs e)
    {
        string pid = SearchBox.Text;

        if (SearchBy.SelectedIndex == 1)
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                pid = (from r in myEntities.Patient__Profile
                       where r.CurrentBedNo == pid
                       select r.Registration_ID).SingleOrDefault();
            }
        }

        Response.Redirect(String.Format("~/ClinicalMonitoring/IntakeOutput.aspx?PID={0}", pid));
    }
Beispiel #16
0
    protected void StaffIDInvalid_ServerValidate(object source, ServerValidateEventArgs args)
    {
        using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
        {
            var profile = (from record in myEntities.Hospital__Staff
                           where record.Staff_ID == UserName.Text
                           select record).SingleOrDefault();

            if (profile != null)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
    }
Beispiel #17
0
    protected void RegistrationIDInvalid_ServerValidate(object source, ServerValidateEventArgs args)
    {
        using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
        {
            var profile = (from record in myEntities.Patient__Profile
                           where record.Registration_ID == UserName.Text
                           select record).SingleOrDefault();

            if (profile != null)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
    }
Beispiel #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (!User.IsInRole("Administrator") && !User.IsInRole("Hospital Superuser") && !User.IsInRole("Hospital Management"))
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
                {
                    hid = (from r in myEntities.Hospital__Staff
                           where r.Staff_ID == Profile.UserName
                           select r.H_ID).SingleOrDefault();

                    if (hid == null)
                    {
                        hid = Profile.UserName;
                    }
                }
            }

            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                var types = (from r in myEntities.Hospital__Bed
                             where r.H_ID == hid
                             select r.Type).Distinct();

                var beds = from r in types
                           select new
                {
                    type = r,
                    bno  = from s in myEntities.Hospital__Bed
                           where (s.H_ID == hid && s.Type == r)
                           select new { s.BedNo }
                };

                Repeater2.DataSource = beds;
                Repeater2.DataBind();
            }
        }
    }
Beispiel #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (!User.IsInRole("Administrator") && !User.IsInRole("Hospital Superuser") && !User.IsInRole("Hospital Management"))
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
                {
                    hid = (from r in myEntities.Hospital__Staff
                           where r.Staff_ID == Profile.UserName
                           select r.H_ID).SingleOrDefault();

                    if (hid == null)
                    {
                        hid = Profile.UserName;
                    }
                }
            }

            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                Repeater1.DataSource = from r in myEntities.Hospital__Department
                                       join d in myEntities.Module__Department on r.D_ID equals d.Department_ID
                                       where r.H_ID == hid
                                       select new { d.Department_ID, d.Name };
                Repeater1.DataBind();
            }

            if (notify == true)
            {
                Notification.Text = note;
                notify            = false;
            }
            else
            {
                Notification.Text = "";
            }
        }
    }
Beispiel #20
0
    protected void Add_Click(object sender, EventArgs e)
    {
        using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
        {
            Hospital__Bed bed = new Hospital__Bed();
            bed.BedNo    = BedNoA.Text;
            bed.Type     = TypeA.Text;
            bed.H_ID     = hid;
            bed.Occupied = false;

            bed.UpdateDateTime = DateTime.Now;
            bed.UpdatedBy      = Profile.UserName;
            bed.UpdateUserName = Profile.Name;

            myEntities.AddToHospital__Bed(bed);
            myEntities.SaveChanges();
        }

        Response.Redirect("~/Hospital/Management/Beds.aspx");
    }
Beispiel #21
0
    protected void Save_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                Patient__Profile profile;
                if (pid != null)
                {
                    profile = (from r in myEntities.Patient__Profile
                               where r.Registration_ID == pid
                               select r).SingleOrDefault();

                    if (profile != null)
                    {
                        profile.Diagnosis = Diagnosis.Text;

                        profile.UpdateDateTime = DateTime.Now;
                        profile.UpdatedBy      = Profile.UserName;
                        profile.UpdateUserName = Profile.Name;
                        myEntities.SaveChanges();

                        Notification.Text = "Changes saved successfully.";
                        System.Threading.Thread.Sleep(10000);
                        Notification.Text = null;
                    }
                    else
                    {
                        MultiView1.ActiveViewIndex = 1;
                    }
                }
                else
                {
                    MultiView1.ActiveViewIndex = 1;
                }
            }
        }
    }
Beispiel #22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (!User.IsInRole("Administrator") && !User.IsInRole("Hospital Superuser") && !User.IsInRole("Hospital Management"))
            {
                Response.Redirect("~/Account/Login.aspx");
            }

            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                // Select Hospital based on current Staff ID
                hid = (from r in myEntities.Hospital__Staff
                       where r.Staff_ID == Profile.UserName
                       select r.H_ID).SingleOrDefault();

                if (hid == null)
                {
                    hid = Profile.UserName;
                }
            }
        }
    }
Beispiel #23
0
    protected void Add_Click(object sender, EventArgs e)
    {
        using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
        {
            try
            {
                Module__Department relation = new Module__Department();
                relation.Name = AddDept.Text.Trim();

                relation.UpdatedBy      = Profile.UserName;
                relation.UpdateDateTime = DateTime.Now;
                relation.UpdateUserName = Profile.Name;

                myEntities.AddToModule__Department(relation);
                myEntities.SaveChanges();
            }
            catch (Exception ex)
            {
                notify = true;
                note   = ex.Message;
            }
        }
    }
Beispiel #24
0
    protected void Save_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                Hospital__Profile hospital = (from r in myEntities.Hospital__Profile
                                              where r.Hospital_ID == hid
                                              select r).SingleOrDefault();

                // Update hospital information
                hospital.Hospital_ID  = HospitalID.Text;
                hospital.HospitalName = Name.Text;
                hospital.LogoUrl      = Logo.ImageUrl;
                hospital.ESTD         = Convert.ToInt16(ESTD.Text);
                hospital.Website      = Website.Text;
                hospital.Email        = Email.Text;
                hospital.Address      = Address.Text;
                hospital.City         = City.Text;
                hospital.Pincode      = Pincode.Text;
                hospital.State        = State.Text;
                hospital.Country      = Country.Text;
                hospital.Phone1       = Phone1.Text;
                hospital.Phone2       = Phone2.Text;
                hospital.Phone3       = Phone3.Text;
                hospital.Phone4       = Phone4.Text;
                Fax.Text = hospital.Fax;

                hospital.UpdateDateTime = DateTime.Now;
                hospital.UpdatedBy      = Profile.UserName;
                hospital.UpdateUserName = Profile.Name;
                myEntities.SaveChanges();
            }
        }

        Response.Redirect("~/Hospital/Management/EditInfo.aspx");
    }
Beispiel #25
0
    protected void Register_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                // Create account and assign role 'Patient'
                string pswd = Password.Text;
                if (RndPswd.Checked)
                {
                    pswd = Membership.GeneratePassword(Membership.MinRequiredPasswordLength,
                                                       Membership.MinRequiredNonAlphanumericCharacters);
                }

                Membership.CreateUser(UserName.Text, pswd, Email.Text);
                ProfileCommon pc = new ProfileCommon();
                pc.Initialize(UserName.Text, true);
                pc.Name = PatientName.Text;
                pc.Save();
                Roles.AddUserToRole(UserName.Text, "Patient");


                // Send account confirmation email
                string fileName = Server.MapPath("~/App_Data/AccountConfirmation.txt");
                string mailBody = File.ReadAllText(fileName);
                mailBody = mailBody.Replace("##Name##", PatientName.Text);
                mailBody = mailBody.Replace("##Role##", "Patient");
                mailBody = mailBody.Replace("##Username##", UserName.Text);
                mailBody = mailBody.Replace("##Password##", pswd);

                MailMessage emailMessage = new MailMessage();
                emailMessage.Subject = "New Account Confirmation";
                emailMessage.Body    = mailBody;
                emailMessage.From    = new MailAddress("*****@*****.**", "NMHC");
                emailMessage.To.Add(new MailAddress(Email.Text, PatientName.Text));

                SmtpClient mySmtpClient = new SmtpClient();
                mySmtpClient.Send(emailMessage);


                // Register above patient
                using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
                {
                    Patient__Profile profile = new Patient__Profile();
                    profile.Registration_ID      = UserName.Text;
                    profile.PatientName          = PatientName.Text;
                    profile.RegistrationDateTime = DateTime.Now;
                    profile.Email = Email.Text;
                    profile.H_ID  = (from r in myEntities.Hospital__Staff
                                     where r.Staff_ID == Profile.UserName
                                     select r.H_ID).SingleOrDefault();

                    profile.UpdatedBy      = Profile.UserName;
                    profile.UpdateUserName = Profile.Name;
                    profile.UpdateDateTime = profile.RegistrationDateTime;

                    myEntities.AddToPatient__Profile(profile);
                    myEntities.SaveChanges();
                }

                Notification.Text = "Your account has been created successfully. " +
                                    "An email has been sent to " + Email.Text + " containing your Username and Password.";
            }
            catch (Exception ex)
            {
                Notification.Text = ex.Message;
                Back.Visible      = true;
                Continue.Visible  = false;

                // Delete partially created user data in case of exception
                using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
                {
                    var profile = (from r in myEntities.Patient__Profile
                                   where r.Registration_ID == UserName.Text
                                   select r).SingleOrDefault();
                    if (profile != null)
                    {
                        myEntities.Patient__Profile.DeleteObject(profile);
                    }
                    myEntities.SaveChanges();
                }

                if (Membership.GetUser(UserName.Text) != null)
                {
                    Membership.DeleteUser(UserName.Text, true);
                }
            }

            MultiView1.ActiveViewIndex = 1;
        }
    }
Beispiel #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        pid = Request.QueryString.Get("PID");
        if (!Page.IsPostBack && pid != null)
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                // Select patient based on registration id
                var p = (from r in myEntities.Patient__Profile
                         where r.Registration_ID == pid
                         select r).SingleOrDefault();

                string hid = (from r in myEntities.Hospital__Staff
                              where r.Staff_ID == Profile.UserName
                              select r.H_ID).SingleOrDefault();

                if (p != null && p.H_ID == hid)
                {
                    RegID.Text = pid;
                    PName.Text = p.PatientName;
                    PBed.Text  = (p.CurrentBedNo == null) ? "Unoccupied" : p.CurrentBedNo;

                    MultiView1.ActiveViewIndex = 0;

                    // Select department ids having selected patient's hospital id
                    var dids = from r in myEntities.Hospital__Department
                               where r.H_ID == p.H_ID
                               select r.D_ID;

                    // Select department names corresponding to selected department ids
                    Department.DataSource = from d in myEntities.Module__Department
                                            join i in dids on d.Department_ID equals i
                                            orderby d.Name ascending
                                            select d.Name;
                    Department.DataBind();

                    // Selext beds correspinding to selected patient's hospital id
                    var beds = (from r in myEntities.Hospital__Bed
                                where (r.H_ID == hid && (r.Occupied == false || r.BedNo == p.CurrentBedNo))
                                orderby r.BedNo ascending
                                select r.BedNo).ToList();

                    beds.Add("Unoccupied");
                    Bed.DataSource = beds;
                    Bed.DataBind();

                    // Initialize form from database
                    Department.SelectedValue = p.Department;
                    Bed.SelectedValue        = (p.CurrentBedNo == null) ? "Unoccupied" : p.CurrentBedNo;
                    Name.Text                   = p.PatientName;
                    SetPicture.Visible          = String.IsNullOrEmpty(p.PhotoURL);
                    DeletePicture.Visible       = !String.IsNullOrEmpty(p.PhotoURL);
                    Photo.ImageUrl              = p.PhotoURL;
                    Sex.SelectedValue           = p.Sex;
                    AgeValue.Text               = p.Age.ToString();
                    AgeUnit.SelectedValue       = p.AgeUnit;
                    Weight.Text                 = p.BodyWeight.ToString();
                    Height.Text                 = p.Height.ToString();
                    MaritalStatus.SelectedValue = p.MaritalStatus;
                    Co.Text = p.C_o;
                    CoRelation.SelectedValue = p.C_o_Relation;
                    MotherName.Text          = p.MothersName;
                    MLC.Text            = p.MLC_No;
                    RName.Text          = p.ReferredBy;
                    RContact.Text       = p.RefContactNo;
                    PrevTreated.Checked = (p.IfPreviouslyTreated == true);
                    PrevID.Text         = p.LastTreatedRegistration_ID;
                    Occupation.Text     = p.Occupation;
                    Financing.Text      = p.Financing;
                    LAddress.Text       = p.LocalAddress;
                    LState.Text         = p.LState;
                    LCountry.Text       = p.LCountry;
                    LPincode.Text       = p.LPincode;
                    LContact1.Text      = p.LContactNo1;
                    LContact2.Text      = p.LContactNo2;
                    LEmail.Text         = p.Email;
                    PAddress.Text       = p.PermanentAddress;
                    PState.Text         = p.PState;
                    PCountry.Text       = p.PCountry;
                    PPincode.Text       = p.PPincode;
                    PContact1.Text      = p.PContactNo1;
                    PContact2.Text      = p.PContactNo2;
                    CName.Text          = p.EmergencyContactPerson;
                    CRelation.Text      = p.CPRelationship;
                    CAddress.Text       = p.CPAddress;
                    CContact1.Text      = p.CPContactNo1;
                    CContact2.Text      = p.CPContactNo2;
                    CEmail.Text         = p.CPEmail;
                    AName.Text          = p.AdmittingPerson;
                    ARelation.Text      = p.APRelationship;
                    AAddress.Text       = p.APAddress;
                    AContact1.Text      = p.APContactNo1;
                    AContact2.Text      = p.APContactNo2;
                }
                else
                {
                    MultiView1.ActiveViewIndex = 1;
                }
            }
        }
    }
Beispiel #27
0
    protected void Save_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                Patient__Profile profile;
                if (pid != null)
                {
                    profile = (from r in myEntities.Patient__Profile
                               where r.Registration_ID == pid
                               select r).SingleOrDefault();

                    if (profile != null)
                    {
                        // Update profile information
                        profile.Department                 = Department.SelectedValue;
                        profile.CurrentBedNo               = (Bed.SelectedValue == "Unoccupied") ? null : Bed.SelectedValue;
                        profile.PatientName                = Name.Text;
                        profile.PhotoURL                   = Photo.ImageUrl;
                        profile.Sex                        = Sex.SelectedValue;
                        profile.Age                        = Convert.ToInt16(AgeValue.Text);
                        profile.AgeUnit                    = AgeUnit.SelectedValue;
                        profile.BodyWeight                 = Convert.ToInt16(Weight.Text);
                        profile.Height                     = Convert.ToInt16(Height.Text);
                        profile.MaritalStatus              = MaritalStatus.SelectedValue;
                        profile.C_o                        = Co.Text;
                        profile.C_o_Relation               = CoRelation.SelectedValue;
                        profile.MothersName                = MotherName.Text;
                        profile.MLC_No                     = MLC.Text;
                        profile.ReferredBy                 = RName.Text;
                        profile.RefContactNo               = RContact.Text;
                        profile.IfPreviouslyTreated        = PrevTreated.Checked;
                        profile.LastTreatedRegistration_ID = PrevID.Text;
                        profile.Occupation                 = Occupation.Text;
                        profile.Financing                  = Financing.Text;
                        profile.LocalAddress               = LAddress.Text;
                        profile.LState                     = LState.Text;
                        profile.LCountry                   = LCountry.Text;
                        profile.LPincode                   = LPincode.Text;
                        profile.LContactNo1                = LContact1.Text;
                        profile.LContactNo2                = LContact2.Text;
                        profile.Email                      = LEmail.Text;
                        profile.PermanentAddress           = PAddress.Text;
                        profile.PState                     = PState.Text;
                        profile.PCountry                   = PCountry.Text;
                        profile.PPincode                   = PPincode.Text;
                        profile.PContactNo1                = PContact1.Text;
                        profile.PContactNo2                = PContact2.Text;
                        profile.EmergencyContactPerson     = CName.Text;
                        profile.CPRelationship             = CRelation.Text;
                        profile.CPAddress                  = CAddress.Text;
                        profile.CPContactNo1               = CContact1.Text;
                        profile.CPContactNo2               = CContact2.Text;
                        profile.CPEmail                    = CEmail.Text;
                        profile.AdmittingPerson            = AName.Text;
                        profile.APRelationship             = ARelation.Text;
                        profile.APAddress                  = AAddress.Text;
                        profile.APContactNo1               = AContact1.Text;
                        profile.APContactNo2               = AContact2.Text;

                        profile.UpdateDateTime = DateTime.Now;
                        profile.UpdatedBy      = Profile.UserName;
                        profile.UpdateUserName = Profile.Name;

                        // Update bed information
                        Hospital__Bed b = (from r in myEntities.Hospital__Bed
                                           where (r.H_ID == profile.H_ID && r.BedNo == PBed.Text)
                                           select r).SingleOrDefault();
                        if (b != null)
                        {
                            b.Occupied = false;                                 // Previous bed occupied status: false
                        }
                        b = (from r in myEntities.Hospital__Bed
                             where (r.H_ID == profile.H_ID && r.BedNo == Bed.SelectedValue)
                             select r).SingleOrDefault();
                        if (b != null)
                        {
                            b.Occupied = true;                                  // Current Bed occupied status: true if selected value is not "Unoccupied"
                        }

                        myEntities.SaveChanges();

                        //Notification.Text = "Changes saved successfully.";
                        //System.Threading.Thread.Sleep(5000);
                        //Notification.Text = null;
                    }
                    else
                    {
                        MultiView1.ActiveViewIndex = 1;
                    }
                }
                else
                {
                    MultiView1.ActiveViewIndex = 1;
                }
            }
        }

        Response.Redirect(String.Format("~/Hospital/PatientInfo/EditInfo.aspx?PID={0}", RegID.Text));
    }
Beispiel #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        pid = Request.QueryString.Get("PID");
        if (!Page.IsPostBack && pid != null)
        {
            using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
            {
                // Select patient based on registration id
                var p = (from r in myEntities.Patient__Profile
                         where r.Registration_ID == pid
                         select r).SingleOrDefault();

                string hid = (from r in myEntities.Hospital__Staff
                              where r.Staff_ID == Profile.UserName
                              select r.H_ID).SingleOrDefault();

                if (p != null && p.H_ID == hid)
                {
                    RegID.Text = pid;
                    PName.Text = p.PatientName;
                    PBed.Text  = (p.CurrentBedNo == null) ? "Unoccupied" : p.CurrentBedNo;

                    MultiView1.ActiveViewIndex = 0;

                    // Initialize form from database
                    Department.Text     = p.Department;
                    Bed.Text            = (p.CurrentBedNo == null) ? "Unoccupied" : p.CurrentBedNo;
                    Name.Text           = p.PatientName;
                    Photo.ImageUrl      = p.PhotoURL;
                    Sex.Text            = p.Sex;
                    AgeValue.Text       = p.Age.ToString();
                    AgeUnit.Text        = p.AgeUnit;
                    Weight.Text         = p.BodyWeight.ToString();
                    Height.Text         = p.Height.ToString();
                    MaritalStatus.Text  = p.MaritalStatus;
                    Co.Text             = p.C_o;
                    CoRelation.Text     = p.C_o_Relation;
                    MotherName.Text     = p.MothersName;
                    MLC.Text            = p.MLC_No;
                    RName.Text          = p.ReferredBy;
                    RContact.Text       = p.RefContactNo;
                    PrevTreated.Visible = PrevID.Visible = Label32.Visible = (p.IfPreviouslyTreated.HasValue == true) ? p.IfPreviouslyTreated.Value : false;
                    PrevID.Text         = p.LastTreatedRegistration_ID;
                    Occupation.Text     = p.Occupation;
                    Financing.Text      = p.Financing;
                    LAddress.Text       = p.LocalAddress;
                    LState.Text         = p.LState;
                    LCountry.Text       = p.LCountry;
                    LPincode.Text       = p.LPincode;
                    LContact1.Text      = p.LContactNo1;
                    LContact2.Text      = p.LContactNo2;
                    LEmail.Text         = p.Email;
                    PAddress.Text       = p.PermanentAddress;
                    PState.Text         = p.PState;
                    PCountry.Text       = p.PCountry;
                    PPincode.Text       = p.PPincode;
                    PContact1.Text      = p.PContactNo1;
                    PContact2.Text      = p.PContactNo2;
                    CName.Text          = p.EmergencyContactPerson;
                    CRelation.Text      = p.CPRelationship;
                    CAddress.Text       = p.CPAddress;
                    CContact1.Text      = p.CPContactNo1;
                    CContact2.Text      = p.CPContactNo2;
                    CEmail.Text         = p.CPEmail;
                    AName.Text          = p.AdmittingPerson;
                    ARelation.Text      = p.APRelationship;
                    AAddress.Text       = p.APAddress;
                    AContact1.Text      = p.APContactNo1;
                    AContact2.Text      = p.APContactNo2;
                    IfDischarged.Text   = (p.IfDischarged == true) ? "DISCHARGED" : null;

                    // Calculate BMI and class
                    if (Weight.Text != null && Height.Text != null)
                    {
                        double bmi = double.Parse(Weight.Text) / Math.Pow(double.Parse(Height.Text), 2) * 10000;
                        BMI.Text = bmi.ToString();
                        string bmiclass;
                        if (bmi < 16)
                        {
                            bmiclass = "Severely Underweight";
                        }
                        else if (bmi < 17)
                        {
                            bmiclass = "Moderately Underweight";
                        }
                        else if (bmi < 18)
                        {
                            bmiclass = "Mild Underweight";
                        }
                        else if (bmi < 25)
                        {
                            bmiclass = "Normal";
                        }
                        else if (bmi < 30)
                        {
                            bmiclass = "Pre Obese (Mild)";
                        }
                        else if (bmi < 35)
                        {
                            bmiclass = "Class I Obese (Moderate)";
                        }
                        else if (bmi < 45)
                        {
                            bmiclass = "Class II Obese (Severe)";
                        }
                        else
                        {
                            bmiclass = "Class III Obese (Morbid)";
                        }
                        BMIClass.Text = bmiclass;
                    }
                }
                else
                {
                    MultiView1.ActiveViewIndex = 1;
                }
            }
        }
    }
Beispiel #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string PID = Request.QueryString.Get("PID");

        if (!Page.IsPostBack)
        {
            if (!User.IsInRole("Administrator") && !User.IsInRole("Hospital Superuser") && !User.IsInRole("Hospital Management") && !User.IsInRole("Nurse"))
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
                {
                    hid = (from r in myEntities.Hospital__Staff
                           where r.Staff_ID == Profile.UserName
                           select r.H_ID).SingleOrDefault();

                    if (hid == null)
                    {
                        hid = Profile.UserName;
                    }
                }
            }

            if (PID != null)
            {
                using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
                {
                    var p = (from r in myEntities.Patient__Profile
                             where r.Registration_ID == PID
                             select r).SingleOrDefault();

                    if (p != null && p.H_ID == hid)
                    {
                        RegID.Text = PID;
                        PName.Text = p.PatientName;
                        PBed.Text  = p.CurrentBedNo;

                        var dates = (from r in myEntities.Clinical_Monitoring__Intake_Output
                                     where r.P_ID == PID
                                     select r.LogDate).Distinct();

                        var orderedDates = from r in dates
                                           orderby r descending
                                           select r;

                        List <String> datelist = new List <String>();

                        foreach (var d in orderedDates)
                        {
                            datelist.Add(d.ToShortDateString());
                        }

                        DateFilter.DataSource = datelist;
                        DateFilter.DataBind();

                        MultiView1.ActiveViewIndex = 0;
                    }
                    else
                    {
                        MultiView1.ActiveViewIndex = 1;
                    }
                }
            }
            else
            {
                MultiView1.ActiveViewIndex = -1;
            }
        }
    }
Beispiel #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        sid = Request.QueryString.Get("SID");

        if (!Page.IsPostBack)
        {
            if (!User.IsInRole("Administrator") && !User.IsInRole("Hospital Superuser") && !User.IsInRole("Hospital Management"))
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
                {
                    hid = (from r in myEntities.Hospital__Staff
                           where r.Staff_ID == Profile.UserName
                           select r.H_ID).SingleOrDefault();

                    if (hid == null)
                    {
                        hid = Profile.UserName;
                    }
                }
            }

            if (sid != null)
            {
                using (NMHCDatabaseEntities myEntities = new NMHCDatabaseEntities())
                {
                    // Select staff based on staff id
                    var s = (from r in myEntities.Hospital__Staff
                             where r.Staff_ID == sid
                             select r).SingleOrDefault();

                    if (s != null && s.H_ID == hid)
                    {
                        StfID.Text = sid;
                        SName.Text = s.StaffName;

                        MultiView1.ActiveViewIndex = 0;

                        // Initialize form from database
                        Name.Text             = s.StaffName;
                        Photo.ImageUrl        = s.PhotoURL;
                        SetPicture.Visible    = String.IsNullOrEmpty(s.PhotoURL);
                        DeletePicture.Visible = !String.IsNullOrEmpty(s.PhotoURL);
                        Designation.Text      = s.Designation;
                        Qualification.Text    = s.Qualification;
                        Info.Text             = s.RelevantInfo;
                        Address.Text          = s.Address;
                        State.Text            = s.State;
                        Country.Text          = s.Country;
                        Pincode.Text          = s.Pincode;
                        Contact1.Text         = s.Phone1;
                        Contact2.Text         = s.Phone2;
                        Email.Text            = s.Email;
                    }
                    else
                    {
                        MultiView1.ActiveViewIndex = 1;
                    }
                }
            }
        }
    }