Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var patient = new Patient
            {
                HospitalNumber = int.Parse(mtbHospitalId.Text),
                Title = (Title)Enum.Parse(typeof(Title), cboTitle.Text),
                LastName = txtLastName.Text,
                FirstName = txtFirstName.Text,
                OtherName = txtMname.Text,
                Gender = (Gender)Enum.Parse(typeof(Gender), cboTitle.Text),
                BirthDate = dtpBirthDate.Value,
                Phone = int.Parse(mtbPhone.Text),
                HomeAddress = txtHomeAdd.Text,
                MaritalStatus = (MaritalStatus)Enum.Parse(typeof(MaritalStatus), cboMaritalStatus.Text)
            };

            using (ClinicModel model = new ClinicModel())
            {
                model.Patients.Add(patient);
            }

            MessageBox.Show("New Patient Registered");

            Close();
        }
Example #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            List<User> users = new List<User>();

            using (ClinicModel context = new ClinicModel())
            {
                users = context.Users
                    .Where(x => x.Username == txtUsername.Text)
                    .ToList();
            }

            if (users.Count == 0)
            {
                DialogResult = DialogResult.No;
                Close();
            }
            else
            {
                User user = users.Single(); 

                if (user.Password.Equals(txtPassword.Text))
                {
                    DialogResult = DialogResult.OK;
                    Close();
                }
                else
                {
                    DialogResult = DialogResult.No;
                    Close();
                }
            }
        }
Example #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Clinic clinic = new Clinic()
            {
                Identifier = int.Parse(txtClinicNumber.Text),
                Title = (Title)Enum.Parse(typeof(Title), cboTitle.Text),
                LastName = txtLastName.Text,
                FirstName = txtFirstName.Text,
                Specialty = txtSpecialty.Text,
                Department = txtDepartment.Text,
                Address = txtAddress.Text,
                Telephone = txtTelephone.Text,
                Email = txtEmail.Text,
                CreatedAt = DateTime.Now
            };

            using (ClinicModel context = new ClinicModel())
            {
                context.Clinicians.Add(clinic);

                context.SaveChanges();
            }

            MessageBox.Show("Clinic Saved");

            Close();
        }
Example #4
0
 private void frmClinicsList_Load(object sender, EventArgs e)
 {
     using (ClinicModel context = new ClinicModel())
     {
         var clinicians = context.Clinicians.ToList();
         dgvClinicians.DataSource = clinicians;
     }
 }
Example #5
0
 private void Load_Users()
 {
     using (ClinicModel context = new ClinicModel())
     {
         var users = context.Users.ToList();
         dataGridView1.DataSource = users;
     }
 }
Example #6
0
 private void Load_ClinicsRecord()
 {
     using (ClinicModel context = new ClinicModel())
     {
         var clinics = context.Clinicians.ToList();
         dgridClinics.DataSource = clinics;
     }
 }
Example #7
0
        private void txtPid_Leave(object sender, EventArgs e)
        {
            int patientId = int.Parse(txtPid.Text);
            Patient patient;

            using (ClinicModel context = new ClinicModel())
            {
                patient = context.Patients
                    .Where(x => x.Identifier == patientId)
                    .Single();
            }

            txtHospNum.Text = patient.HospitalNumber.ToString();
            txtPatname.Text = patient.FirstName + " " + patient.LastName;
        }
Example #8
0
        private void btnChangePass_Click(object sender, EventArgs e)
        {
            int id = (int)dataGridView1.SelectedRows[0].Cells[0].Value;
            User user;

            using (ClinicModel context = new ClinicModel())
            {
                user = context.Users
                    .Where(x => x.Identifier.Equals(id))
                    .Single();
            }

            frmChangePass frm = new frmChangePass(user);
            frm.ShowDialog();

        }
Example #9
0
        private void btnEditC_Click(object sender, EventArgs e)
        {
            if (dgvClinicians.SelectedColumns.Count > 0)
            {
                object id = dgvClinicians.SelectedRows[0].Cells[0].Value;
                Clinic clinic;

                using (ClinicModel context = new ClinicModel())
                {
                    clinic = context.Clinicians
                        .Where(x => x.Identifier.Equals(id))
                        .Single();
                }

                frmEditClinic frm = new frmEditClinic(clinic);
                frm.ShowDialog();
            }
        }
Example #10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            User user = new User()
            {
                FirstName = txtFName.Text,
                LastName = txtLName.Text,
                Username = txtUsername.Text,
                Password = txtPassword.Text,
                ModuleAccess = txtProfile.Text
            };

            using (ClinicModel context = new ClinicModel())
            {
                context.Users.Add(user);

                context.SaveChanges();
            }

            MessageBox.Show("New User Created");

            Close();
        }
Example #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            List<Patient> patients = new List<Patient>();

            using (ClinicModel context = new ClinicModel())
            {
                var patientsQuery = context.Patients.AsQueryable();

                if (txtPatientId.Text.Trim().Length > 0)
                {
                    patientsQuery = patientsQuery.Where(x => x.Identifier == int.Parse(txtPatientId.Text));
                }

                if (txtLastName.Text.Trim().Length > 0)
                {
                    patientsQuery = patientsQuery.Where(x => x.LastName == txtLastName.Text);
                }

                if (txtFirstName.Text.Trim().Length > 0)
                {
                    patientsQuery = patientsQuery.Where(x => x.FirstName == txtFirstName.Text);
                }

                if (txtHospNum.Text.Trim().Length > 0)
                {
                    patientsQuery = patientsQuery.Where(x => x.HospitalNumber == int.Parse(txtHospNum.Text));
                }

                patients = patientsQuery.ToList();
            }

            if (patients.Count == 0)
            {
                MessageBox.Show("No Patient Found");
                return;
            }

            dgvPatients.DataSource = patients;
        }
Example #12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var ap = new Appointment()
            {
                Identifier = int.Parse(txtCNum.Text),
                ClinicianName = txtPatConsultant.Text,
                PatientId = int.Parse(txtPid.Text),
                HospitalNumber = int.Parse(txtHospNum.Text),
                PatientName = txtPatname.Text,
                Created = dateTimePicker1.Value,
                Purpose = txtApptPurpose.Text,
                CreatedAt = DateTime.Now
            };

            using (ClinicModel context = new ClinicModel())
            {
                context.Appointments.Add(ap);

                context.SaveChanges();
            }

            MessageBox.Show("Clinic Saved");
        }
Example #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtPassConfirm.Text == txtPassword.Text)
            {
                _user.Password = txtPassword.Text;

                using (ClinicModel context = new ClinicModel())
                {
                    context.Users.Attach(_user);

                    context.SaveChanges();
                }

                MessageBox.Show("Password changed successfully");

                Close();
            }
            else
            {
                MessageBox.Show("Please confirm Password and Confirm Pasword fields match");
                txtPassword.Text = "";
                txtPassConfirm.Text = "";
            }
        }
Example #14
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            txtDateAmend.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

            var patient = new Patient()
            {
                Identifier = int.Parse(txtPid.Text),
                HospitalNumber = int.Parse(txtHospNum.Text),
                Title = (Title)Enum.Parse(typeof(Title), cmbtitle.Text),
                LastName = txtLname.Text,
                FirstName = txtFname.Text,
                MiddleName = txtMname.Text,
                Gender = (Gender)Enum.Parse(typeof(Gender), cmbGender.Text),
                BirthDate = DateTime.Parse(txtDob.Text),
                Phone = int.Parse(txtPhone.Text),
                MobilePhone = int.Parse(txtMPhone.Text),
                Email = txtEmail.Text,
                HomeAddress = txtHAddress.Text,
                City = txtCity.Text,
                State = txtState.Text,
                MaritalStatus = (MaritalStatus)Enum.Parse(typeof(MaritalStatus), cmbMStatus.Text),
                PatientConsultant = txtPatConsultant.Text,
                Nationality = txtNat.Text,
                StateOfOrigin = txtSOrigin.Text,
                Hometown = txtTOrigin.Text,
                PlaceOfBirth = txtPoB.Text,
                Religion = txtReligion.Text,
                Occupation = txtOccupation.Text,
                OfficeAddress = txtOAddress.Text,
                NationalIdType = cmbNIDType.Text,
                NationalIdNumber = txtNidNumber.Text,
                NextOfKin = txtNok.Text,
                AddressNextOfKin = txtNoKAddress.Text,
                PhoneNextOfKin = int.Parse(txtNoKPhone.Text),
                EmailNextOfKin = txtNoKEmail.Text,
                NextOfKinRelationship = cmbNokRelationship.Text,
                NameOfFather = txtFather.Text,
                NameOfMother = txtMother.Text,
                HealthInsuranceProvider = txtHealthIns.Text,
                AddressHealthInsuranceProvider = txtHealthAddr.Text,
                PhoneHealthInsuranceProvider = int.Parse(txtHealthPhone.Text),
                EmailHealthInsuranceProvider = txtHealthEmail.Text,
                DateAmended = txtDateAmend.Text,
                Photo = GetBytesFromImage()
            };

            using (ClinicModel context = new ClinicModel())
            {
                context.Patients.Add(patient);

                context.SaveChanges();
            }

            GetBytesFromImage();

            MessageBox.Show("Patient Record Updated");
        }
Example #15
0
        private void Load_ClinicsRecord()
        {
            List<Clinic> clinics = new List<Clinic>();

            using (ClinicModel context = new ClinicModel())
            {
                clinics = context.Clinicians.ToList();
            }

            dgridClinics.DataSource = clinics;
        }
Example #16
0
        private void record_delete()
        {
            using (ClinicModel context = new ClinicModel())
            {
                context.Patients.Remove(new Patient() { Identifier = int.Parse(txtPid.Text) });
            }

            MessageBox.Show("Patient Record Deleted");
        }