Exemplo n.º 1
0
        private void btSpecialtyAdd_Click(object sender, EventArgs e)
        {
            if (tbSname.Text.Trim().Length == 0)
            {
                tsslSpecialty.ForeColor = Color.Crimson;
                tsslSpecialty.Text      = "Invalid data";
                return;
            }
            using (var client = new HaServiceClient())
            {
                Specialty specialty = new Specialty();
                var       allsp     = client.GetSpecialties();
                foreach (var item in allsp)
                {
                    if (item.SpecialtyName == tbSname.Text.Trim())
                    {
                        tsslSpecialty.ForeColor = Color.Crimson;
                        tsslSpecialty.Text      = "Specialty alredy exist";
                        return;
                    }
                }

                specialty.SpecialtyName = tbSname.Text.Trim();
                client.AddSpecialty(specialty);

                FillSpecialtyListView();
                FillCbChoseSpesialty();
                tsslSpecialty.ForeColor = Color.DarkGreen;
                tsslSpecialty.Text      = "Specialty added";
                tbSname.Text            = "";
            }
        }
Exemplo n.º 2
0
        private void FillPatientListView()
        {
            lvPatients.Items.Clear();

            using (var client = new HaServiceClient())
            {
                var patients = client.GetAllPatients();

                foreach (var item in patients)
                {
                    ListViewItem lvItem = new ListViewItem(item.FirstName);
                    lvItem.SubItems.Add(item.LastName); //.ToString());
                    lvItem.SubItems.Add(item.SecondName);
                    lvItem.SubItems.Add(item.Email);
                    lvItem.SubItems.Add(item.Login);
                    lvItem.SubItems.Add(item.Phone.home);
                    lvItem.SubItems.Add(item.Phone.mobile);
                    lvItem.SubItems.Add(item.Phone.work);
                    lvItem.SubItems.Add(item.HistoryBook.BookNumber.ToString());
                    lvItem.SubItems.Add(item.Address.StreetName.ToString());
                    lvItem.SubItems.Add(item.PatientId.ToString());
                    lvPatients.Items.Add(lvItem);
                }
            }
        }
Exemplo n.º 3
0
        private void btSpecialtyDelete_Click(object sender, EventArgs e)
        {
            int selectedDoctorssCount = lvSpecialty.SelectedItems.Count;

            if (selectedDoctorssCount != 0)
            {
                ListViewItem selectedSpecialty = lvSpecialty.SelectedItems[0];
                int          selectedId        = int.Parse(selectedSpecialty.SubItems[0].Text);
                var          confirmResult     = MessageBox.Show("Are you sure to delete this Specialty?\nSpecialty :  " + selectedSpecialty.SubItems[1].Text, "Confirm delete!", MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.Yes)
                {
                    using (var client = new HaServiceClient())
                    {
                        Specialty specialty            = client.GetSpecialtyById(selectedId);
                        var       getAllDocBySpecialty = client.GetDoctorsBySpecialy(selectedId);
                        if (getAllDocBySpecialty.Length != 0)
                        {
                            tsslSpecialty.ForeColor = Color.Crimson;
                            tsslSpecialty.Text      = "Unable to delete, doctors with this sp exist";
                            return;
                        }
                        client.DeleteSpecialty(specialty);
                        FillSpecialtyListView();
                        FillCbChoseSpesialty();
                        tsslSpecialty.ForeColor = Color.Green;
                        tsslSpecialty.Text      = "Specialty sucssesfuly deleted";
                    }
                }
                else
                {
                    //DialogResult = DialogResult.None;
                    return;
                }
            }
        }
Exemplo n.º 4
0
        private void btRoomDelete_Click(object sender, EventArgs e)
        {
            int selectedRoomsCount = lvRooms.SelectedItems.Count;

            if (selectedRoomsCount != 0)
            {
                ListViewItem selectedRoom  = lvRooms.SelectedItems[0];
                Guid         selectedId    = Guid.Parse(selectedRoom.SubItems[3].Text);
                var          confirmResult = MessageBox.Show("Are you sure to delete this room?\nRoom Number " + int.Parse(selectedRoom.SubItems[0].Text), "Confirm edit!", MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.Yes)
                {
                    using (var client = new HaServiceClient())
                    {
                        client.DeleteRoomById(selectedId);
                    }
                    tsslRoom.Text = "Room deleted";
                    FillRoomListView();
                }
                else
                {
                    //DialogResult = DialogResult.None;
                    return;
                }
            }
        }
Exemplo n.º 5
0
        private void btdDelete_Click(object sender, EventArgs e)
        {
            int selectedDoctorssCount = lvDoctors.SelectedItems.Count;

            if (selectedDoctorssCount != 0)
            {
                ListViewItem selectedDoctor = lvDoctors.SelectedItems[0];
                //var ddd = selectedPatient.SubItems[10].Text;
                Guid selectedId    = Guid.Parse(selectedDoctor.SubItems[5].Text);
                var  confirmResult = MessageBox.Show("Are you sure to delete this Doctor?\nDoctor login " + selectedDoctor.SubItems[3].Text, "Confirm edit!", MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.Yes)
                {
                    using (var client = new HaServiceClient())
                    {
                        client.DeleteDoctorById(selectedId);
                    }
                    FillDoctorListView();
                }
                else
                {
                    //DialogResult = DialogResult.None;
                    return;
                }
            }
        }
Exemplo n.º 6
0
        private void cbChoseSpesialty_SelectedIndexChanged(object sender, EventArgs e)
        {
            ResetRadioButtons();

            mcThisMonth.Enabled = false;
            RadioButtonsEnabledFalse();

            using (var client = new HaServiceClient())
            {
                var check = client.GetDoctorsBySpecialy(client.GetSpecialtyIdByName(cbChoseSpesialty.SelectedItem.ToString()));
                if (check.Length > 0)
                {
                    cbChoseDoctor.DataSource =
                        client.GetDoctorsBySpecialy(client.GetSpecialtyIdByName(cbChoseSpesialty.SelectedItem.ToString()));
                    cbChoseDoctor.DisplayMember = "FirstName";
                    cbChoseDoctor.ValueMember   = "DoctorId";
                }
                else
                {
                    cbChoseDoctor.Enabled = false;
                    //mcThisMonth.Enabled = false;
                    //RadioButtonsEnabledFalse();
                }
                cbChoseDoctor.Enabled = true;
            }
        }
Exemplo n.º 7
0
        private void btpAddPatient_Click(object sender, EventArgs e)
        {
            Patient patient = new Patient();

            patient.FirstName  = tbpName.Text;
            patient.SecondName = tbpPoB.Text;
            patient.LastName   = tbpSurName.Text;
            patient.Email      = tbpEmail.Text;
            patient.Login      = tbpLogin.Text;
            //patient.Hash = "hash";
            patient.Role = "User";

            Phone phone = new Phone();

            phone.home   = tbpHomePhone.Text;
            phone.mobile = tbpMobilePhone.Text;
            phone.work   = tbpWorkPhone.Text;

            patient.Phone = phone;

            Passport passport = new Passport();

            passport.BDay    = int.Parse(tbpBday.Text);
            passport.BMonth  = int.Parse(tbpBmonth.Text);
            passport.BYear   = int.Parse(tbpByear.Text);
            passport.DayIoP  = int.Parse(tbpDayIoP.Text);
            passport.SeriesA = tbpPassSereise.Text;
            passport.SeriesN = int.Parse(tbpSereiseNumber.Text);
            passport.YearIoP = int.Parse(tbpYearIoP.Text);

            patient.Passport = passport;

            Address address = new Address();

            address.ApartamentNumber = int.Parse(tbpAn.Text);
            address.StreetName       = tbpStreet.Text;

            patient.Address = address;

            HistoryBook historyBook = new HistoryBook();

            historyBook.BookNumber = int.Parse(tbpHisBookNum.Text);

            patient.HistoryBook = historyBook;

            using (var client = new HaServiceClient())
            {
                patient.Hash = client.CreateHashOnServer("111111");
                client.AddPatient(patient);
                CrealPatentTbFields();
            }

            FillPatientListView();
        }
Exemplo n.º 8
0
 private void FillCbChoseSpesialty()
 {
     cbChoseSpesialty.Items.Clear();
     using (var client = new HaServiceClient())
     {
         foreach (var item in client.GetSpecialties())
         {
             cbChoseSpesialty.Items.Add(item.SpecialtyName);
         }
     }
 }
Exemplo n.º 9
0
        private void cbChoseDoctor_SelectedIndexChanged(object sender, EventArgs e)
        {
            ResetRadioButtons();
            RadioButtonsEnabledFalse();

            using (var client = new HaServiceClient())
            {
                var item = cbChoseDoctor.SelectedItem as Doctor;

                _doctor = client.GetDoctorById(item.DoctorId); // cbChoseDoctor.SelectedItem.V  Value.ToString());
            }

            mcThisMonth.Enabled = true;

            mcThisMonth.RemoveAllBoldedDates();
            DateTime today   = DateTime.Now;
            DateTime endDate = today.AddMonths(1);

            while (today <= endDate)
            {
                if (today.DayOfWeek == DayOfWeek.Monday && _doctor.DaysOfReceiving.Mondey == true)
                {
                    mcThisMonth.AddBoldedDate(today);
                }
                if (today.DayOfWeek == DayOfWeek.Tuesday && _doctor.DaysOfReceiving.Tuesday == true)
                {
                    mcThisMonth.AddBoldedDate(today);
                }
                if (today.DayOfWeek == DayOfWeek.Wednesday && _doctor.DaysOfReceiving.Wednesday == true)
                {
                    mcThisMonth.AddBoldedDate(today);
                }
                if (today.DayOfWeek == DayOfWeek.Thursday && _doctor.DaysOfReceiving.Thursday == true)
                {
                    mcThisMonth.AddBoldedDate(today);
                }
                if (today.DayOfWeek == DayOfWeek.Friday && _doctor.DaysOfReceiving.Friday == true)
                {
                    mcThisMonth.AddBoldedDate(today);
                }
                if (today.DayOfWeek == DayOfWeek.Saturday && _doctor.DaysOfReceiving.Satarday == true)
                {
                    mcThisMonth.AddBoldedDate(today);
                }
                if (today.DayOfWeek == DayOfWeek.Sunday && _doctor.DaysOfReceiving.Sunday == true)
                {
                    mcThisMonth.AddBoldedDate(today);
                }
                today = today.AddDays(1);
            }
            mcThisMonth.UpdateBoldedDates();
        }
Exemplo n.º 10
0
        private void btCanselApp_Click(object sender, EventArgs e)
        {
            int selectedAnimal = lvPatientApp.SelectedItems.Count;

            if (selectedAnimal != 0)
            {
                ListViewItem selectedItem = lvPatientApp.SelectedItems[0];
                Guid         selectedId   = Guid.Parse(selectedItem.SubItems[4].Text);
                using (var client = new HaServiceClient())
                {
                    client.DeleteAppointmentById(selectedId);
                }

                FillListView();
            }
        }
Exemplo n.º 11
0
        private void RefreshPatientForm()
        {
            cbChoseDoctor.Enabled = false;
            mcThisMonth.Enabled   = false;
            RadioButtonsEnabledFalse();

            using (var client = new HaServiceClient())
            {
                foreach (var item in client.GetSpecialties())
                {
                    cbChoseSpesialty.Items.Add(item.SpecialtyName);
                }
            }

            FillListView();
        }
Exemplo n.º 12
0
 private void EditRoom_Load(object sender, EventArgs e)
 {
     using (var client = new HaServiceClient())
     {
         _room = client.GetRoomById(_roomId);
     }
     tbNewRoomNumber.Text = _room.RoomNumber.ToString();
     tbNewRoomType.Text   = _room.Type;
     if (_room.Unavaible == false)
     {
         rbNo.Select();
     }
     else
     {
         rbYes.Select();
     }
 }
Exemplo n.º 13
0
        private void FillSpecialtyListView()
        {
            lvSpecialty.Items.Clear();

            using (var client = new HaServiceClient())
            {
                var specialty = client.GetSpecialties();

                foreach (var item in specialty)
                {
                    //var spesialty = client.GetSpecialtyById(item.SpecialtyId);
                    ListViewItem lvItem = new ListViewItem(item.SpecialtyId.ToString());
                    lvItem.SubItems.Add(item.SpecialtyName);
                    lvSpecialty.Items.Add(lvItem);
                }
            }
        }
Exemplo n.º 14
0
        private void btEditRoom_Click(object sender, EventArgs e)
        {
            if (tbNewRoomNumber.Text.Trim().Length == 0)
            {
                labelEditError.ForeColor = Color.Crimson;
                labelEditError.Text      = "Enter valid data";
                DialogResult             = DialogResult.None;
                return;
            }
            var confirmResult = MessageBox.Show("Are you sure to edit this room?\nNew Number " + tbNewRoomNumber.Text, "Confirm edit!", MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                using (var client = new HaServiceClient())
                {
                    var checkSameRoom = client.GetRooms();
                    foreach (var item in checkSameRoom)
                    {
                        if (item.RoomNumber == int.Parse(tbNewRoomNumber.Text))
                        {
                            labelEditError.ForeColor = Color.Crimson;
                            labelEditError.Text      = "Room Already Exist";
                            DialogResult             = DialogResult.None;
                            return;
                        }
                    }
                    _room.RoomNumber = int.Parse(tbNewRoomNumber.Text);
                    _room.Type       = tbNewRoomType.Text;
                    if (rbYes.Checked == true)
                    {
                        _room.Unavaible = true;
                    }
                    else
                    {
                        _room.Unavaible = false;
                    }
                    client.EditRoom(_room);
                }
            }
            else
            {
                DialogResult = DialogResult.None;
                //return;
            }
        }
Exemplo n.º 15
0
        private void FillRoomListView()
        {
            lvRooms.Items.Clear();

            using (var client = new HaServiceClient())
            {
                var rooms = client.GetRooms();

                foreach (var item in rooms)
                {
                    ListViewItem lvItem = new ListViewItem(item.RoomNumber.ToString());
                    lvItem.SubItems.Add(item.Type); //.ToString());
                    lvItem.SubItems.Add(item.Unavaible.ToString());
                    lvItem.SubItems.Add(item.RoomId.ToString());
                    lvRooms.Items.Add(lvItem);
                }
            }
        }
Exemplo n.º 16
0
        private void btLogin_Click(object sender, System.EventArgs e)
        {
            /*Patient patient = new Patient();
             * patient.Role = "Doctor";
             * Doctor doc = new Doctor();
             * doc.Role = "Doctor";
             * this.Hide();
             * AppointmentForm appointmentForm = new AppointmentForm(doc);
             * appointmentForm.Show();*/

            if (tbLogin.Text.Trim() != "" && tbLogin.Text.Trim().Length > 4 && tbLogin.Text.Trim().Length < 31 && tbPassword.Text.Trim() != "" &&
                tbPassword.Text.Trim().Length > 4)
            {
                using (var client = new HaServiceClient())
                {
                    this.Enabled = false;
                    Patient patient = client.VerefyAuth(tbLogin.Text.Trim(), tbPassword.Text.Trim());
                    Doctor  doc     = client.VerefyAuthDoc(tbLogin.Text.Trim(), tbPassword.Text.Trim());
                    if (patient != null)
                    {
                        MessageBox.Show("Login Successful!");
                        this.Hide();
                        AppointmentForm appointmentForm = new AppointmentForm(patient);
                        appointmentForm.Show();
                    }
                    else if (doc != null)
                    {
                        this.Hide();
                        AppointmentForm appointmentForm = new AppointmentForm(doc);
                        appointmentForm.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Login or Password");
                    }
                }
            }
            else
            {
                MessageBox.Show("Invalid Login or Password");
                //return;
            }
            this.Enabled = true;
        }
Exemplo n.º 17
0
        private void FillListView()
        {
            lvPatientApp.Items.Clear();

            using (var client = new HaServiceClient())
            {
                var appoinments = client.GetAppoinments();

                foreach (var item in appoinments)
                {
                    ListViewItem lvItem = new ListViewItem(item.Date.ToShortDateString());
                    lvItem.SubItems.Add(item.Time);
                    lvItem.SubItems.Add(item.Doctor.FirstName);
                    lvItem.SubItems.Add(item.Room.RoomNumber.ToString());
                    lvItem.SubItems.Add(item.AppointmentId.ToString());
                    lvPatientApp.Items.Add(lvItem);
                }
            }
        }
Exemplo n.º 18
0
 private void btEditDocPasSave_Click(object sender, EventArgs e)
 {
     if (tbEditDocPassword.Text.Trim() == tbEditDocPasswordRepeat.Text.Trim() && tbEditDocPasswordRepeat.Text.Trim().Length > 5 &&
         tbEditDocPasswordRepeat.Text.Trim().Length < 30)
     {
         using (var client = new HaServiceClient())
         {
             _doctor.HashD = client.CreateHashOnServer(tbEditDocPasswordRepeat.Text.Trim());
             client.EditDoctor(_doctor);
             tsslEditDocPas.ForeColor = Color.Green;
             tsslEditDocPas.Text      = "Password changed";
         }
     }
     else
     {
         tsslEditDocPas.ForeColor = Color.Crimson;
         tbEditDocPassword.Clear();
         tbEditDocPasswordRepeat.Clear();
         tsslEditDocPas.Text = "Invadid new password, try again";
     }
 }
Exemplo n.º 19
0
        private void FillDoctorListView()
        {
            lvDoctors.Items.Clear();

            using (var client = new HaServiceClient())
            {
                Doctor[] doors = client.GetDoctors();


                foreach (var item in doors)
                {
                    var          spesialty = client.GetSpecialtyById(item.Specialty.SpecialtyId);
                    ListViewItem lvItem    = new ListViewItem(spesialty.SpecialtyName);
                    lvItem.SubItems.Add(item.LastName);  //.ToString());
                    lvItem.SubItems.Add(item.FirstName); //.ToString());
                    lvItem.SubItems.Add(item.SecondName);
                    lvItem.SubItems.Add(item.LoginD);
                    lvItem.SubItems.Add(item.DoctorId.ToString());
                    lvDoctors.Items.Add(lvItem);
                }
            }
        }
Exemplo n.º 20
0
        private void btAddRoom_Click(object sender, EventArgs e)
        {
            Room room = new Room();

            room.RoomNumber = int.Parse(tbRoomNumber.Text);
            room.Type       = tbRoomType.Text;

            if (rbYes.Checked == true)
            {
                room.Unavaible = true;
            }
            else
            {
                room.Unavaible = false;
            }
            using (var client = new HaServiceClient())
            {
                client.InsertRoom(room);
            }
            tsslRoom.Text = "Room added";
            RefreshForm();
        }
Exemplo n.º 21
0
        private void btEditDocPasConfirm_Click(object sender, EventArgs e)
        {
            using (var client = new HaServiceClient())
            {
                _doctor = client.GetDoctorById(_doctorId);
                string confirm = tbEditDocCurrentPassword.Text.Trim();
                var    hash    = client.VerefyAuthDoc(_doctor.LoginD, confirm)?.HashD;
                if (confirm.Length < 6 || confirm.Length > 30 || hash == null)
                {
                    tsslEditDocPas.ForeColor = Color.Crimson;
                    tsslEditDocPas.Text      = "Invadid password";
                    return;
                }

                if (hash == _doctor.HashD)
                {
                    tbEditDocPassword.Enabled       = true;
                    tbEditDocPasswordRepeat.Enabled = true;
                    tsslEditDocPas.ForeColor        = Color.Blue;
                    tsslEditDocPas.Text             = "Enter new password";
                }
            }
        }
Exemplo n.º 22
0
        private void FillDoctorListView()
        {
            lvDoc.Items.Clear();

            using (var client = new HaServiceClient())
            {
                var appoinments = client.GetAppoinmentsByDate(DateTime.Today).Where(id => id.Doctor.DoctorId.Equals(_doctor.DoctorId));
                if (appoinments.Count() < 1)
                {
                    return;
                }
                foreach (var item in appoinments)
                {
                    ListViewItem lvItem = new ListViewItem(item.Patient.FirstName);
                    lvItem.SubItems.Add(item.Patient.SecondName);
                    lvItem.SubItems.Add(item.Patient.LastName);
                    lvItem.SubItems.Add(item.Patient.HistoryBook.BookNumber.ToString());
                    //lvItem.SubItems.Add(item.Patient.HistoryBook.BookNumber.ToString());
                    lvItem.SubItems.Add(item.Room.RoomNumber.ToString());
                    lvItem.SubItems.Add(item.Time);
                    lvDoc.Items.Add(lvItem);
                }
            }
        }
Exemplo n.º 23
0
        private void btAddDoc_Click(object sender, EventArgs e)
        {
            Doctor doc = new Doctor();

            doc.FirstName  = tbDocName.Text;
            doc.LastName   = tbLastName.Text;
            doc.SecondName = tbSecondName.Text;
            doc.LoginD     = tbDocLogin.Text;
            doc.Role       = "Doctor";


            DaysOfReceiving dor = new DaysOfReceiving();

            if (clbDay.GetItemCheckState(0) == CheckState.Checked)
            {
                dor.Mondey = true;
            }
            if (clbDay.GetItemCheckState(1) == CheckState.Checked)
            {
                dor.Tuesday = true;
            }
            if (clbDay.GetItemCheckState(2) == CheckState.Checked)
            {
                dor.Wednesday = true;
            }
            if (clbDay.GetItemCheckState(3) == CheckState.Checked)
            {
                dor.Thursday = true;
            }
            if (clbDay.GetItemCheckState(4) == CheckState.Checked)
            {
                dor.Friday = true;
            }
            if (clbDay.GetItemCheckState(5) == CheckState.Checked)
            {
                dor.Satarday = true;
            }
            if (clbDay.GetItemCheckState(6) == CheckState.Checked)
            {
                dor.Sunday = true;
            }

            TimeOfReceiving time = new TimeOfReceiving();

            if (clbTime.GetItemCheckState(0) == CheckState.Checked)
            {
                time.T10_00 = true;
            }
            if (clbTime.GetItemCheckState(1) == CheckState.Checked)
            {
                time.T10_20 = true;
            }
            if (clbTime.GetItemCheckState(2) == CheckState.Checked)
            {
                time.T10_40 = true;
            }
            if (clbTime.GetItemCheckState(3) == CheckState.Checked)
            {
                time.T11_00 = true;
            }
            if (clbTime.GetItemCheckState(4) == CheckState.Checked)
            {
                time.T12_00 = true;
            }

            dor.TimeOfReceiving = time;
            doc.DaysOfReceiving = dor;

            using (var client = new HaServiceClient())
            {
                //doc.Specialty = client.GetSpecialtyByName(cbChoseSpesialty.SelectedItem.ToString());//. SelectedText);
                doc.HashD = client.CreateHashOnServer(tbDocPassword.Text);
                client.AddDoctorOnContext(doc,
                                          client.GetSpecialtyByName(cbChoseSpesialty.SelectedItem.ToString()).SpecialtyId);
            }
            FillDoctorListView();
        }
Exemplo n.º 24
0
        private void btAddAppointment_Click(object sender, EventArgs e)
        {
            Appoinment appoinment = new Appoinment();

            appoinment.Date = mcThisMonth.SelectionRange.Start.Date; //DateTime.Now;
            //new DateTime(2017, 4, 5);//mcThisMonth.SelectionRange.Start.Date;
            appoinment.Patient = _currentUser;
            appoinment.Doctor  = _doctor;

            string time = "0";

            if (rb1000.Checked == true)
            {
                time = "10:00";
            }
            if (rb1020.Checked == true)
            {
                time = "10:20";
            }
            if (rb1040.Checked == true)
            {
                time = "10:40";
            }
            if (rb1100.Checked == true)
            {
                time = "11:00";
            }
            if (rb1200.Checked == true)
            {
                time = "12:00";
            }


            using (var client = new HaServiceClient())
            {
                var        rooms   = client.GetRooms();
                List <int> roomNum = rooms.Select(room => room.RoomNumber).ToList();

                if (time != "0")
                {
                    foreach (
                        var item in
                        client.GetAppoinmentsByDate(mcThisMonth.SelectionRange.Start)
                        .Where(t => t.Time.Equals(time)))
                    {
                        foreach (var room in rooms)
                        {
                            if (room.RoomNumber == item.Room.RoomNumber)
                            {
                                roomNum.Remove(room.RoomNumber);
                            }
                        }
                    }
                }
                else
                {
                    return;
                }
                if (roomNum.Count != 0)
                {
                    appoinment.Room = client.GetRoomByNumber(roomNum.First());
                    var room = client.GetRoomByNumber(roomNum.First());

                    appoinment.RecordNumber = 1;
                    appoinment.Time         = time;
                    //client.AddAppointment(appoinment);
                    client.AddAppointmentOnContext(_doctor.DoctorId, _currentUser.PatientId, room.RoomId, appoinment);
                    Refresh();
                }
                else
                {
                    return;
                }
            }



            //appoinment.Room
        }
Exemplo n.º 25
0
        private void btSaveChanges_Click(object sender, EventArgs e)
        {
            Doctor editDoctor = _doctor;

            editDoctor.FirstName  = tbEditDocName.Text.Trim();
            editDoctor.LastName   = tbEditDocLastName.Text.Trim();
            editDoctor.SecondName = tbEditDocSecName.Text.Trim();
            DaysOfReceiving dor  = new DaysOfReceiving();
            TimeOfReceiving time = new TimeOfReceiving();

            dor = editDoctor.DaysOfReceiving;
            int timeCount = 0;
            int dayCount  = 0;

            if (clbDay.GetItemCheckState(0) == CheckState.Checked)
            {
                dor.Mondey = true; dayCount++;
            }
            else
            {
                dor.Mondey = false;                                                                                              //clbDay.SetItemChecked(0, false);
            }
            if (clbDay.GetItemCheckState(1) == CheckState.Checked)
            {
                dor.Tuesday = true; dayCount++;
            }
            else
            {
                dor.Tuesday = false;                                                                                              //clbDay.SetItemChecked(1, false);
            }
            if (clbDay.GetItemCheckState(2) == CheckState.Checked)
            {
                dor.Wednesday = true; dayCount++;
            }
            else
            {
                dor.Wednesday = false;                                                                                              //clbDay.SetItemChecked(2, false);
            }
            if (clbDay.GetItemCheckState(3) == CheckState.Checked)
            {
                dor.Thursday = true; dayCount++;
            }
            else
            {
                dor.Thursday = false;                                                                                              //clbDay.SetItemChecked(3, false);
            }
            if (clbDay.GetItemCheckState(4) == CheckState.Checked)
            {
                dor.Friday = true; dayCount++;
            }
            else
            {
                dor.Friday = false;                                                                                              //clbDay.SetItemChecked(4, false);
            }
            if (clbDay.GetItemCheckState(5) == CheckState.Checked)
            {
                dor.Satarday = true; dayCount++;
            }
            else
            {
                dor.Satarday = false;                                                                                              //clbDay.SetItemChecked(5, false);
            }
            if (clbDay.GetItemCheckState(6) == CheckState.Checked)
            {
                dor.Sunday = true; dayCount++;
            }
            else
            {
                dor.Sunday = false;                                                                                              //clbDay.SetItemChecked(6, false);
            }
            time = editDoctor.DaysOfReceiving.TimeOfReceiving;
            if (clbTime.GetItemCheckState(0) == CheckState.Checked)
            {
                time.T10_00 = true; timeCount++;
            }
            else
            {
                time.T10_00 = false;                                                                                              //clbTime.SetItemChecked(0, false);
            }
            if (clbTime.GetItemCheckState(1) == CheckState.Checked)
            {
                time.T10_20 = true; timeCount++;
            }
            else
            {
                time.T10_20 = false;                                                                                              //clbTime.SetItemChecked(1, false);
            }
            if (clbTime.GetItemCheckState(2) == CheckState.Checked)
            {
                time.T10_40 = true; timeCount++;
            }
            else
            {
                time.T10_40 = false;                                                                                              //clbTime.SetItemChecked(2, false);
            }
            if (clbTime.GetItemCheckState(3) == CheckState.Checked)
            {
                time.T11_00 = true; timeCount++;
            }
            else
            {
                time.T11_00 = false;                                                                                              //clbTime.SetItemChecked(3, false);
            }
            if (clbTime.GetItemCheckState(4) == CheckState.Checked)
            {
                time.T12_00 = true; timeCount++;
            }
            else
            {
                time.T12_00 = false;                                                                                              //clbTime.SetItemChecked(4, false);
            }
            if (editDoctor.FirstName.Length <= 3 || editDoctor.FirstName.Length > 30 || editDoctor.LastName.Length <= 3 || editDoctor.LastName.Length > 30 ||
                editDoctor.SecondName.Length <= 3 || editDoctor.SecondName.Length > 30 || timeCount == 0 || dayCount == 0)
            {
                tsslEditDoc.ForeColor = Color.Crimson;
                tsslEditDoc.Text      = "Invalid Data";
            }
            else
            {
                using (var client = new HaServiceClient())
                {
                    client.EditDoctor(editDoctor);
                    client.EditDays(dor);
                    client.EditTime(time);
                    DialogResult = DialogResult.OK;
                }
            }
        }
Exemplo n.º 26
0
        private void mcThisMonth_DateSelected(object sender, DateRangeEventArgs e)
        {
            ResetRadioButtons();
            RadioButtonsEnabledFalse();
            tbSelectedData.Text = mcThisMonth.SelectionRange.Start.ToShortDateString();
            List <string> times = new List <string>();

            if (_doctor.DaysOfReceiving.TimeOfReceiving.T10_00 == true)
            {
                times.Add("10:00");
            }
            if (_doctor.DaysOfReceiving.TimeOfReceiving.T10_20 == true)
            {
                times.Add("10:20");
            }
            if (_doctor.DaysOfReceiving.TimeOfReceiving.T10_40 == true)
            {
                times.Add("10:40");
            }
            if (_doctor.DaysOfReceiving.TimeOfReceiving.T11_00 == true)
            {
                times.Add("11:00");
            }
            if (_doctor.DaysOfReceiving.TimeOfReceiving.T12_00 == true)
            {
                times.Add("12:00");
            }

            List <string> freeTimeForDate = new List <string>();

            freeTimeForDate = times;

            List <string> myAppTimeForToday = new List <string>();

            using (var client = new HaServiceClient())
            {
                foreach (var item in client.GetAppoinmentsByDate(mcThisMonth.SelectionRange.Start.Date).Where(pId => pId.Patient.PatientId.Equals(_currentUser.PatientId)))
                {
                    freeTimeForDate.Remove(item.Time);
                }
            }


            using (var client = new HaServiceClient())
            {
                var appByDoc = client.GetAppoinmentsByDate(mcThisMonth.SelectionRange.Start).Where(d => d.Doctor.DoctorId.Equals(_doctor.DoctorId));
                foreach (var app in appByDoc)
                {
                    foreach (var time in times)
                    {
                        if (app.Time == time)
                        {
                            freeTimeForDate.Remove(time);
                        }
                    }
                }
                if (freeTimeForDate.Count == 0)
                {
                    return;
                }

                var        rooms   = client.GetRooms();
                List <int> roomNum = new List <int>();

                foreach (var time in freeTimeForDate)
                {
                    foreach (var room in rooms)
                    {
                        roomNum.Add(room.RoomNumber);
                    }

                    foreach (var item in client.GetAppoinmentsByDate(mcThisMonth.SelectionRange.Start).Where(t => t.Time.Equals(time)))
                    {
                        foreach (var room in rooms)
                        {
                            if (room.RoomNumber == item.Room.RoomNumber)
                            {
                                roomNum.Remove(room.RoomNumber);
                            }
                        }
                    }

                    if (roomNum.Count != 0)
                    {
                        switch (time)
                        {
                        case "10:00":
                            rb1000.Enabled = true;
                            break;

                        case "10:20":
                            rb1020.Enabled = true;
                            break;

                        case "10:40":
                            rb1040.Enabled = true;
                            break;

                        case "11:00":
                            rb1100.Enabled = true;
                            break;

                        case "12:00":
                            rb1200.Enabled = true;
                            break;
                        }
                    }
                }

                /*foreach (var item in client.GetAppoinmentsByDate(mcThisMonth.SelectionRange.Start))
                 * {
                 *  if (item.Time == "10:00") rb1000.Enabled = false;
                 *  if (item.Time == "10:20") rb1020.Enabled = false;
                 *  if (item.Time == "10:40") rb1040.Enabled = false;
                 *  if (item.Time == "11:00") rb1100.Enabled = false;
                 *  if (item.Time == "12:00") rb1200.Enabled = false;
                 *
                 *  //cbChoseSpesialty.Items.Add(item.SpecialtyName);
                 * }*/
            }
        }
Exemplo n.º 27
0
        public void RefreshUcDoc()
        {
            FillDoctorListView();
            //Doctor doc = new Doctor();
            using (var client = new HaServiceClient())
            {
                _doctor = client.GetDoctorById(_doctor.DoctorId);
            }
            labelDocName.Text  = _doctor.FirstName;
            labelWorkDays.Text = "";

            if (_doctor.DaysOfReceiving.Mondey == true)
            {
                labelWorkDays.Text = "M";
            }
            if (_doctor.DaysOfReceiving.Tuesday == true)
            {
                labelWorkDays.Text += "  T";
            }
            if (_doctor.DaysOfReceiving.Wednesday == true)
            {
                labelWorkDays.Text += "  W";
            }
            if (_doctor.DaysOfReceiving.Thursday == true)
            {
                labelWorkDays.Text += "  Th";
            }
            if (_doctor.DaysOfReceiving.Friday == true)
            {
                labelWorkDays.Text += "  F";
            }
            if (_doctor.DaysOfReceiving.Satarday == true)
            {
                labelWorkDays.Text += "  St";
            }
            if (_doctor.DaysOfReceiving.Sunday == true)
            {
                labelWorkDays.Text += "  S";
            }

            labelTimeDoc.Text = "";
            if (_doctor.DaysOfReceiving.TimeOfReceiving.T10_00 == true)
            {
                labelTimeDoc.Text = "10:00";
            }
            if (_doctor.DaysOfReceiving.TimeOfReceiving.T10_20 == true)
            {
                labelTimeDoc.Text += "  10:20";
            }
            if (_doctor.DaysOfReceiving.TimeOfReceiving.T10_40 == true)
            {
                labelTimeDoc.Text += "  10:40";
            }
            if (_doctor.DaysOfReceiving.TimeOfReceiving.T11_00 == true)
            {
                labelTimeDoc.Text += "  11:00";
            }
            if (_doctor.DaysOfReceiving.TimeOfReceiving.T12_00 == true)
            {
                labelTimeDoc.Text += "  12:00";
            }
        }