private void PopulateAppointmentTable(string query = sql)
        {
            AppointmentRepo appointment = new AppointmentRepo();

            this.dgvAppointment.AutoGenerateColumns = false;
            this.dgvAppointment.DataSource          = appointment.GetAllAppointmentInformation(query);
        }
Beispiel #2
0
 private void btnCancel_Click_1(object sender, EventArgs e)
 {
     if (txtPersonID.Text != "")
     {
         var answer = MessageBox.Show("Cancel Appointment", "Cancel", MessageBoxButtons.YesNo);
         if (answer == DialogResult.Yes)
         {
             AppointmentRepo appointmentRepo = new AppointmentRepo();
             DataGridViewRow dataRow         = dgvAppointmentView.CurrentRow;
             //CancelledAppointmentsRepo.CreateCancelledAppointment(dataRow.Cells[8].Value.ToString(), dataRow.Cells[7].Value.ToString(), Convert.ToInt32(dataRow.Cells[1].Value.ToString()), Doctorid);
             //appointmentRepo.DeleteAppointment(Convert.ToInt32(dataRow.Cells[0].Value.ToString()));
             //MessageBox.Show(cmbAppointmentTime.Text);
             DateTime.Parse(dtpAppointmentDate.Text);
             //MessageBox.Show(DateTime.Parse(dtpAppointmentDate.Text).ToString("d"));
             CancelledAppointmentsRepo.CreateCancelledAppointment(cmbAppointmentTime.Text.ToString(), DateTime.Parse(dtpAppointmentDate.Text).ToString("d"), Convert.ToInt32(txtPersonID.Text), Doctorid);
             AppointmentRepo.DeleteByPatient(Convert.ToInt32(txtPersonID.Text), Doctorid);
             MessageBox.Show("Appointment cancelled successfully");
             PopulateGridView();
             ClearInfo();
         }
     }
     else
     {
         MessageBox.Show("NO appointment is selected");
     }
 }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (String.IsNullOrEmpty(this.txtAppointmentID.Text))
         {
             throw new Exception("Select Appointment you want to cancel");
         }
         var ask = MessageBox.Show("Do you want to cancel this appointment?", "Querstion", MessageBoxButtons.YesNo);
         if (ask == DialogResult.Yes)
         {
             AppointmentRepo ap     = new AppointmentRepo();
             int             result = ap.DeleteAppointment(Convert.ToInt32(this.txtAppointmentID.Text));
             if (result == 1)
             {
                 MessageBox.Show("Appointment deleted successfully");
                 this.PopulateAppointmentTable();
                 this.ClearAll();
             }
             else
             {
                 MessageBox.Show("Appointment not found");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #4
0
        public override ActionResult Edit(FormCollection collection)
        {
            AppointmentRepo   repo  = new AppointmentRepo();
            UserRepo          urepo = new UserRepo();
            AppointmentEditVM model = new AppointmentEditVM();

            TryUpdateModel(model);
            User doctor = urepo.GetById(model.SelectedDoctorId);

            foreach (var item in doctor.AppointmentsDoctor)
            {
                if ((model.ArrangeTime <= item.ArrangeTime.AddHours(1)) && (model.ArrangeTime > item.ArrangeTime) || (model.ArrangeTime == item.ArrangeTime))
                {
                    return(RedirectToAction("BusyArrangeTime", "Patient"));
                }
            }
            if (ModelState.IsValid)
            {
                Appointment entity = new Appointment();
                PopulateEntity(entity, model);
                repo.DbContext.Entry(entity.Patient).State = System.Data.Entity.EntityState.Unchanged;
                repo.DbContext.Entry(entity.Doctor).State  = System.Data.Entity.EntityState.Unchanged;
                repo.Save(entity);
                return(Redirect());
            }
            return(View(model));
        }
 //Metoda usuwająca element z bazy
 private void DeleteButtonClick(object sender, RoutedEventArgs e)
 {
     if (TabsComboBox.SelectedIndex == 0)
     {
         MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz usunąć?", "Alert", MessageBoxButton.YesNo);
         if (result == MessageBoxResult.Yes)
         {
             int index = AppointmentTab.AppointmentIndex;
             AppointmentRepo.DeleteAppointment(Lists.Appointments[index].ID_wizyty.ToString());
             TableSpace.Children.Clear();
             TableSpace.Children.Add(new AppointmentTab(1));
         }
     }
     else if (TabsComboBox.SelectedIndex == 1)
     {
         MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz usunąć?", "Alert", MessageBoxButton.YesNo);
         if (result == MessageBoxResult.Yes)
         {
             int index = PatientTab.PatientIndex;
             if (DeletePeselCheck(Lists.Patients[index].PESEL) == true)
             {
                 MessageBox.Show("Nie można usunąć pacjenta z wizytami!");
             }
             else
             {
                 PatientRepo.DeletePatient(Lists.Patients[index].PESEL);
                 TableSpace.Children.Clear();
                 TableSpace.Children.Add(new PatientTab());
             }
         }
     }
 }
        private void mbtnInsert_Click(object sender, EventArgs e)
        {
            var entity = new AppointmentEntity();
            var repo   = new AppointmentRepo();

            //var app = new Appoinment();
            //entity.ConvertToEntity(this);
            entity.GeneratedId      = this.txtId.Text;
            entity.PatientName      = this.lblName.Text;
            entity.PatientAge       = Int32.Parse(this.lblAge.Text);
            entity.PatientSex       = this.lblSex.Text;
            entity.PatientReference = this.lblRefer.Text;
            entity.AppoinmentDate   = this.mdtAppoinmentDate.Value.Date.ToString("yyyy-MM-dd");
            entity.PatientDoctor    = mgvDoctorAppointment.CurrentRow.Cells["name"].Value.ToString();
            entity.Time             = this.dtpTime.Value.ToString();
            if (MessageBox.Show("Are you sure?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }
            else
            {
                repo.InsertAppoinment(entity);
                this.Hide();
                re.Show();
                re.Clear();
            }
        }
Beispiel #7
0
        private void btnCancelAllToday_Click(object sender, EventArgs e)
        {
            DataTable appointmentTable = AppointmentRepo.GetSpecificDoctorAppointments(Doctorid);

            if (appointmentTable.Rows.Count > 0)
            {
                var answer = MessageBox.Show("Cancel All Today's Appointment", "Cancel", MessageBoxButtons.YesNo);
                if (answer == DialogResult.Yes)
                {
                    for (int ax = 0; ax < appointmentTable.Rows.Count; ax++)
                    {
                        AppointmentRepo.DeleteAllToday(Doctorid);
                        CancelledAppointmentsRepo.CreateCancelledAppointment(appointmentTable.Rows[ax]["starttime"].ToString(), appointmentTable.Rows[ax]["date"].ToString(), Convert.ToInt32(appointmentTable.Rows[ax]["personid"].ToString()), Doctorid);
                    }
                    MessageBox.Show("All appointments cancelled successfully");

                    PopulateGridView();
                    ClearInfo();
                }
            }
            else
            {
                MessageBox.Show("NO appointments to cancel today");
            }
        }
Beispiel #8
0
        //Konstruktor wyświetla dane w zależności od wyboru
        public AppointmentTab(int ViewType)
        {
            InitializeComponent();
            List <Appointment> AppointmentList = AppointmentRepo.GetAllAppoitments();

            if (ViewType == 1)
            {
                AppointmentListView.ItemsSource = AppointmentList;
            }
            else if (ViewType == 2)
            {
                AppointmentListView.ItemsSource = Lists.TodayAppointments();
            }
            else if (ViewType == 3)
            {
                AppointmentListView.ItemsSource = Lists.PatientAppointments();
            }
            else if (ViewType == 4)
            {
                AppointmentListView.ItemsSource = Lists.DoctorAppointments();
            }


            AppointmentListView.Items.Refresh();
        }
Beispiel #9
0
        private void btnDeleteAppointment_Click(object sender, EventArgs e)
        {
            var selectedAppointment = (Appointment)dgAppointments.SelectedRows[0].DataBoundItem;

            AppointmentRepo.DeleteAppointment(selectedAppointment.Id);
            BindGrids();
        }
Beispiel #10
0
        private void btnTypesReport_Click(object sender, EventArgs e)
        {
            var appointments = AppointmentRepo.GetAllAppointments();

            var report = GenerateMonthlyTypesReport(appointments);

            MessageBox.Show(report);
        }
Beispiel #11
0
 public void BindGrids()
 {
     Customers = CustomerRepo.GetAllCustomers();
     dgCustomers.DataSource = Customers;
     dgCustomers.Columns["Address"].Visible   = false;
     dgCustomers.Columns["AddressId"].Visible = false;
     Appointments = AppointmentRepo.GetAppointmentsForUser();
     dgAppointments.DataSource = Appointments;
 }
Beispiel #12
0
        private void btnDeleteCustomer_Click(object sender, EventArgs e)
        {
            var selectedCustomer = (Customer)dgCustomers.SelectedRows[0].DataBoundItem;

            AppointmentRepo.DeleteAppointmentsForCustomer(selectedCustomer.Id);
            CustomerRepo.DeleteCustomer(selectedCustomer.Id);
            AddressRepo.DeleteAddress(selectedCustomer.AddressId);
            BindGrids();
        }
Beispiel #13
0
 public void AppointmentRepoSetup()
 {
     _dbController   = new TestDbController();
     _controller     = Controller.GetInstance();
     _departmentRepo = DepartmentRepo.GetInstance(_dbController, practitioners);
     departments     = _departmentRepo.GetDepartments();
     users           = _controller.GetUsers();
     _instance       = AppointmentRepo.GetInstance(_dbController, users, departments);
 }
        public ActionResult Decline(int id)
        {
            Appointment     appointment = new Appointment();
            AppointmentRepo repo        = new AppointmentRepo();

            appointment        = repo.GetById(id);
            appointment.Status = Status.Decline;
            repo.Save(appointment);
            return(RedirectToAction("Index"));
        }
Beispiel #15
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context        = context;
     Patients        = new PatientRepo(context);
     Appointments    = new AppointmentRepo(context);
     Attandences     = new AttendanceRepo(context);
     Cities          = new CityRepo(context);
     Doctors         = new DoctorRepo(context);
     Specializations = new SpecializationRepo(context);
     Users           = new ApplicationUserRepo(context);
 }
        public void GetController(Controller newController)
        {
            controller           = newController;
            guestRepo            = controller.guestRepo;
            appointmentRepo      = controller.appointmentRepo;
            DataContext          = guestRepo;
            listView.ItemsSource = guestRepo.guests;
            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(listView.ItemsSource);

            view.Filter = UserFilter;
        }
        private void btnDeleteAll_Click(object sender, EventArgs e)
        {
            var answer = MessageBox.Show("Delete All entry", "Delete All", MessageBoxButtons.YesNo);

            if (answer == DialogResult.Yes)
            {
                AppointmentRepo.RemoveParticularDoctorsAppointments(Doctorid);
                MessageBox.Show("All entries deleted Successfully ");
                PopulateGridView();
                ClearInfo();
            }
        }
Beispiel #18
0
        public HomeController(IConfiguration iconfiguration)
        {
            string con = iconfiguration.GetSection("ConnectionStrings").GetSection("connectionstring").Value;

            iappointmentContext = new AppointmentMsSqlContext(con);
            appointmentrepo     = new AppointmentRepo(iappointmentContext);

            iaccountcontext = new AccountMsSqlContext(con);
            accountrepo     = new AccountRepo(iaccountcontext);

            accVeri = new AccountVerification();
        }
Beispiel #19
0
 public EntityService()
 {
     _appointmentService = new AppointmentRepo();
     _cityService        = new CityRepo();
     _hospitalService    = new HospitalRepo();
     _patientRepo        = new PatientRepo();
     _policlinicService  = new PoliclinicRepo();
     _staffRepo          = new StaffRepo();
     _titleService       = new TitleRepo();
     _townService        = new TownRepo();
     _userService        = new UserRepo();
 }
Beispiel #20
0
        protected override void DeleteFilter(int id)
        {
            AppointmentRepo    aRepo           = new AppointmentRepo();
            List <Appointment> appointmentsDoc = aRepo.GetAll(ap => ap.Doctor.Id == id).ToList();
            List <Appointment> appointmentsPat = aRepo.GetAll(ap => ap.Patient.Id == id).ToList();

            for (int i = 0; i < appointmentsDoc.Count; i++)
            {
                aRepo.Delete(appointmentsDoc[i]);
            }
            for (int i = 0; i < appointmentsPat.Count; i++)
            {
                aRepo.Delete(appointmentsPat[i]);
            }
        }
Beispiel #21
0
        public APIInteraction(IConfiguration iconfiguration)
        {
            config = iconfiguration;
            string con = config.GetSection("ConnectionStrings").GetSection("connectionstring").Value;

            iappointmentcontext = new AppointmentMsSqlContext(con);
            appointmentrepo     = new AppointmentRepo(iappointmentcontext);

            inotificationcontext = new NotificationMsSqlContext(con);
            notificationrepo     = new NotificationRepo(inotificationcontext);

            iaccountcontext = new AccountMsSqlContext(con);
            accountrepo     = new AccountRepo(iaccountcontext);

            notificationController = new NotificationController(config);
        }
        public ActionResult ReviewApproved()
        {
            AppointmentIndexVM model = new AppointmentIndexVM();

            model.Pager = new PagerVM();
            TryUpdateModel(model);
            AppointmentRepo repo        = new AppointmentRepo();
            string          prefix      = "Pager.";
            string          action      = this.ControllerContext.RouteData.Values["action"].ToString();
            string          controller  = this.ControllerContext.RouteData.Values["controller"].ToString();
            int             resultCount = repo.Count(ap => ap.Doctor.Id == AuthenticationManager.LoggedUser.Id && ap.Status == Status.Approved);

            model.Pager = new PagerVM(resultCount, model.Pager.CurrentPage, model.Pager.PageSize, prefix, action, controller);
            model.Items = repo.GetAll(ap => ap.Doctor.Id == AuthenticationManager.LoggedUser.Id && ap.Status == Status.Approved, model.Pager.CurrentPage, model.Pager.PageSize.Value).ToList();
            return(View(model));
        }
Beispiel #23
0
        public ActionResult ViewConfirmed()
        {
            AppointmentIndexVM model = new AppointmentIndexVM();
            AppointmentRepo    repo  = new AppointmentRepo();

            model.Items = repo.GetAll(ap => ap.Patient.Id == AuthenticationManager.LoggedUser.Id && ap.Status == DataAccess.Tools.Enums.Status.Approved && ap.Seen == false).ToList();
            foreach (var item in model.Items)
            {
                if (!item.Seen)
                {
                    item.Seen = true;
                    repo.Save(item);
                }
            }

            return(View(model));
        }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (txtPersonID.Text != "")
     {
         var answer = MessageBox.Show("Delete Appointment", "Delete", MessageBoxButtons.YesNo);
         if (answer == DialogResult.Yes)
         {
             AppointmentRepo.DeleteCompletedAppointment(Convert.ToInt32(txtPersonID.Text));
             MessageBox.Show("Deleted Successfully");
             ClearInfo();
             PopulateGridView();
         }
     }
     else
     {
         MessageBox.Show("No Patient is Selected");
     }
 }
        public ActionResult GetAll()
        {
            AppointmentIndexVM model = new AppointmentIndexVM();
            AppointmentRepo    repo  = new AppointmentRepo();

            model.Pager  = new PagerVM();
            model.Filter = new AppointmentFilterVM();
            TryUpdateModel(model);
            model.Filter.Prefix = "Filter.";
            string prefix      = "Pager.";
            string action      = this.ControllerContext.RouteData.Values["action"].ToString();
            string controller  = this.ControllerContext.RouteData.Values["controller"].ToString();
            int    resultCount = repo.Count(model.Filter.BuildFilter());

            model.Pager = new PagerVM(resultCount, model.Pager.CurrentPage, model.Pager.PageSize, prefix, action, controller);
            model.Filter.ParentPager = model.Pager;
            model.Items = repo.GetAll(model.Filter.BuildFilter(), model.Pager.CurrentPage, model.Pager.PageSize.Value).ToList();
            return(View(model));
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            PersonRepo p1 = new PersonRepo();

            p1.PersonID = Convert.ToInt32(this.txtPID.Text);

            DoctorRepo dr = new DoctorRepo();

            if (this.txtDoctorId.Text != "" && this.txtDoctorId.Text != null)
            {
                dr.DoctorID = Convert.ToInt32(this.txtDoctorId.Text);
            }

            EmployeeRepo er = new EmployeeRepo();

            er.EmpID = Convert.ToInt32(this.txtEmpId.Text);

            try
            {
                if (this.cmbDesignation.Text == "Doctor")
                {
                    // IF DOCTOR -> Delete from all table that contains doctor's reference first
                    CancelledAppointmentsRepo.RemoveParticularDoctorsAppointments(dr.DoctorID);
                    AppointmentRepo.RemoveParticularDoctorsAppointments(dr.DoctorID);
                    PatientDiseaseRepo.DeleteInfoBasedOnDoctor(dr.DoctorID);
                    LoginVerification.DeleteLoginInfo(er.EmpID);
                    // Afterwards delete from doctor table
                    dr.DeleteDoctor(dr.DoctorID);
                }

                int empdelete     = er.DeleteEmployee(er.EmpID);
                int persondeleted = p1.DeletePerson(p1.PersonID);

                this.PopulatePersonTable();
                MessageBox.Show("Successfully deleted!");
                this.ClearAll();
            }
            catch (Exception exc)
            {
                MessageBox.Show("error!" + exc);
            }
        }
Beispiel #27
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                lblError.Visible = true;
                return;
            }

            if (Mode == DetailMode.Add)
            {
                var appointment = ConstructAppointment();
                AppointmentRepo.SaveAppointment(appointment);
            }
            else if (Mode == DetailMode.Modify)
            {
                var appointment = ConstructAppointment();
                AppointmentRepo.UpdateAppointment(appointment);
            }

            Dashboard.BindGrids();
            Close();
        }
Beispiel #28
0
        private void btnMasterSchedule_Click(object sender, EventArgs e)
        {
            var report = $"Master Schedule Report \n  Requested {DateTime.Now.ToString("f", DateTimeFormatInfo.InvariantInfo)} \n";

            var users        = UserRepo.GetAllUsers();
            var appointments = AppointmentRepo.GetAllAppointments();

            foreach (var user in users)
            {
                report += $"\n {user.UserName} \n-------------\n";
                var appointmentsForUser = appointments.Where(a => a.UserId == user.Id).ToList();
                foreach (var appt in appointmentsForUser)
                {
                    report += $"\n {appt.Title} \n";
                    report += $"Start: {appt.Start.ToString("f", DateTimeFormatInfo.InvariantInfo)} -\n";
                    report += $"End: {appt.End.ToString("f", DateTimeFormatInfo.InvariantInfo)} -\n";
                    report += $"Location: {appt.Location} \n";
                }
            }

            MessageBox.Show(report);
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dtpAppointmentDate.Value.Date < DateTime.Today)
                {
                    throw new Exception("Selected date must be of today or future");
                }

                DoctorRepo doctorRepo = new DoctorRepo();
                DataTable  doctorData = doctorRepo.GetIndividualDoctorsInfo(Convert.ToInt32(this.txtDoctorID.Text));
                doctorRepo.DoctorID           = Convert.ToInt32(doctorData.Rows[0]["doctorid"].ToString());
                doctorRepo.Specialty          = doctorData.Rows[0]["specialty"].ToString();
                doctorRepo.AvailableDays      = doctorData.Rows[0]["availabledays"].ToString();
                doctorRepo.EmployeeIdOfDoctor = Convert.ToInt32(doctorData.Rows[0]["empid"].ToString());

                // Check if available day of doctor matches with appointment day
                string[] daysAvailabe  = doctorRepo.AvailableDays.Split(' ');
                bool     checkValidDay = false;
                //string selectedDay = dtpAppointmentDate.Value.DayOfWeek.ToString().Substring(0, 3).ToLower();
                string selectedDay = dtpAppointmentDate.Value.DayOfWeek.ToString().Substring(0, 3);
                foreach (string days in daysAvailabe)
                {
                    if (days.Equals(selectedDay))
                    {
                        checkValidDay = true;
                        break;
                    }
                    else
                    {
                        checkValidDay = false;
                    }
                }
                // If its a invalid day
                if (!checkValidDay)
                {
                    throw new Exception("Doctor not available on this day. Check Available days");
                }

                AppointmentRepo ap = new AppointmentRepo();
                ap.AppointmentID = Convert.ToInt32(this.txtAppointmentID.Text);
                ap.Time          = this.cmbAppointmentTime.Text.ToString();
                ap.Date          = this.dtpAppointmentDate.Value.ToString("MM/dd/yyyy");
                ap.DoctorID      = Convert.ToInt32(this.txtDoctorID.Text);
                ap.PatientID     = Convert.ToInt32(this.txtPatientID.Text);
                // Check if clash appointment
                if (ap.RowExits(ap.Time, ap.Date, ap.DoctorID))
                {
                    throw new Exception("Clash Appointment");
                }
                // If no clash appointment then proceed
                var ask = MessageBox.Show("Confirm appointment update?", "Question", MessageBoxButtons.YesNo);
                if (ask == DialogResult.Yes)
                {
                    int appointmentUpdated = ap.UpdateAppointment(ap.AppointmentID, ap.Time, ap.Date, ap.PatientID, ap.DoctorID);
                    if (appointmentUpdated == 1)
                    {
                        MessageBox.Show("Appointment Updated");
                        this.PopulateAppointmentTable();
                        this.ClearAll();
                    }
                    else
                    {
                        MessageBox.Show("Error");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void SaveAppointmentButtonClick(object sender, RoutedEventArgs e)
        {
            if (ID_wizytyTextBox.Text == "")
            {
                MessageBox.Show("Pole ID Wizyty jest puste!");
            }
            else if (PESEL_Combobox.SelectedIndex == -1)
            {
                MessageBox.Show("Pole PESEL nie zostało wybrane!");
            }
            else if (NrSaliComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Pole Nr sali nie zostało wybrane!");
            }
            else if (IdLekarzaComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Pole Id lekarza nie zostało wybrane!");
            }
            else if (DataWizytyCombobox.SelectedIndex == -1)
            {
                MessageBox.Show("Pole Data wizyty nie zostało wybrane!");
            }
            else if (GodzWizytyComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Pole Godzina wizyty nie zostało wybrane!");
            }
            else if (RodzajWizytyComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Pole Rodzaj wizyty nie zostało wybrane!");
            }
            else if (OpisTextBox.Text == "")
            {
                MessageBox.Show("Pole Opis objawów nie zostało wybrane!");
            }
            else if (OpisTextBox.Text == "")
            {
                MessageBox.Show("Pole Opis objawów nie zostało wybrane!");
            }
            else if (OpisTextBox.Text == "")
            {
                MessageBox.Show("Pole Opis objawów nie zostało wybrane!");
            }
            else if (RoomCheck(ID_wizytyTextBox.Text.ToString(), NrSaliComboBox.SelectedItem.ToString(), DataWizytyCombobox.SelectedItem.ToString(), GodzWizytyComboBox.SelectedItem.ToString()) == true)
            {
                MessageBox.Show("Sala w tym terminie jest już zajęta!");
            }
            else if (DoctorCheck(ID_wizytyTextBox.Text.ToString(), IdLekarzaComboBox.SelectedItem.ToString(), DataWizytyCombobox.SelectedItem.ToString(), GodzWizytyComboBox.SelectedItem.ToString()) == true)
            {
                MessageBox.Show("Lekarz w tym terminie jest już zajęty!");
            }
            else if (PatientCheck(ID_wizytyTextBox.Text.ToString(), PESEL_Combobox.SelectedItem.ToString(), DataWizytyCombobox.SelectedItem.ToString(), GodzWizytyComboBox.SelectedItem.ToString()) == true)
            {
                MessageBox.Show("Pacjent w tym terminie jest już zajęty!");
            }
            else
            {
                if (FunctionName.Content.ToString() == "Dodaj wizytę")
                {
                    AppointmentRepo.AddNewAppointment(ID_wizytyTextBox.Text.ToString(), PESEL_Combobox.SelectedItem.ToString(), IdLekarzaComboBox.SelectedItem.ToString(), NrSaliComboBox.SelectedItem.ToString(), RodzajWizytyComboBox.SelectedItem.ToString(),
                                                      OpisTextBox.Text.ToString(), DataWizytyCombobox.SelectedItem.ToString(), GodzWizytyComboBox.SelectedItem.ToString(), ChorobaTextBox.Text.ToString(), LeczenieTextBox.Text.ToString(), ZwolnienieTextBox.Text.ToString());

                    DataChangedEventHandler handler = DataChanged;
                    if (handler != null)
                    {
                        handler(this, new EventArgs());
                    }

                    this.Close();
                }
                if (FunctionName.Content.ToString() == "Edytuj wizytę")
                {
                    AppointmentRepo.EditAppointment(ID_wizytyTextBox.Text.ToString(), PESEL_Combobox.SelectedItem.ToString(), IdLekarzaComboBox.SelectedItem.ToString(), NrSaliComboBox.SelectedItem.ToString(), RodzajWizytyComboBox.SelectedItem.ToString(),
                                                    OpisTextBox.Text.ToString(), DataWizytyCombobox.SelectedItem.ToString(), GodzWizytyComboBox.SelectedItem.ToString(), ChorobaTextBox.Text.ToString(), LeczenieTextBox.Text.ToString(), ZwolnienieTextBox.Text.ToString());

                    DataChangedEventHandler handler = DataChanged;
                    if (handler != null)
                    {
                        handler(this, new EventArgs());
                    }

                    this.Close();
                }
            }
        }