ice
New member
I have asked at four different forums and no one ends up helping me. I'm pretty much at the end here, everything is becoming a blur and I don't remember what I have and haven't tried.
One last damn explanation of the whole thing: This program is a scheduling program for a doctor. The core program was bought from a company called ComponentOne, and initially it worked fine as it was. You open it up and it's just a calendar with time slots, when you double click a time a new form opens. Then my task was to create a custom form to collect the appointment information (patient info, date, time, type of appointment etc.) which meant bypassing the default form and getting the new one to do what the old did.
So I did that and eventually got it to "save" the information just for the current session, so when you'd double click the appointment again all the info is there. Problem is once it closes it obviously loses that since I can't get the database to update.
I need it to update the Appointments database that has the patient name and date/time but don't know why it's not working. I also need it to let me pick a doctor from a list and have it only show that doctor's appointments, like a filter of sorts. That doesn't work either, the screen refreshes but it adds nothing from a database of past appointments.
I'll post the full code from the one form here, hopefully this made sense and someone can help out. If you need any other info let me know.
One last damn explanation of the whole thing: This program is a scheduling program for a doctor. The core program was bought from a company called ComponentOne, and initially it worked fine as it was. You open it up and it's just a calendar with time slots, when you double click a time a new form opens. Then my task was to create a custom form to collect the appointment information (patient info, date, time, type of appointment etc.) which meant bypassing the default form and getting the new one to do what the old did.
So I did that and eventually got it to "save" the information just for the current session, so when you'd double click the appointment again all the info is there. Problem is once it closes it obviously loses that since I can't get the database to update.
I need it to update the Appointments database that has the patient name and date/time but don't know why it's not working. I also need it to let me pick a doctor from a list and have it only show that doctor's appointments, like a filter of sorts. That doesn't work either, the screen refreshes but it adds nothing from a database of past appointments.
I'll post the full code from the one form here, hopefully this made sense and someone can help out. If you need any other info let me know.
Code:
Imports C1.Win.C1Schedule
Imports C1.C1Schedule
Imports System.ComponentModel
Imports System.Drawing
Imports System.Drawing.Text
Imports System.Drawing.Printing
Imports System.Data
Public Class frmAppt
Inherits Form
' collection of levels
Dim _doctor As ScheduleOwner
Public Structure ScheduleOwner
Dim _index As String
Dim _description As String
' structure to keep information about patients
Public Sub New(ByVal row As DataRow)
_index = row("ID")
_description = row("Dr First Name").ToString() + " " + row("Dr Last Name").ToString()
End Sub
Public ReadOnly Property Index() As String
Get
Return _index
End Get
End Property
Public Overrides Function ToString() As String
Return _description
End Function
End Structure
InitializeComponent()
End Sub
'Jarrod
Private Sub frmAppt_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
'Me.AppointmentsTableAdapter.Update(Me.Appointments._Appointments)
Me.AppointmentsTableAdapter.Update(EbtblsDataSet1.Appointments)
Me.DOCTORSTableAdapter.Update(EbtblsDataSet1.DOCTORS)
'Me.AppointmentsTableAdapter.Update(EbtblsDataSet3.Appointments)
'Me.LabelsTableAdapter.Update(EyeBaseDataSet.Labels)
'Me.StatusesTableAdapter.Update(EyeBaseDataSet.Statuses)
End Sub
Private Sub frmAppt_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'EbtblsDataSet2.DOCTORS' table. You can move, or remove it, as needed.
Me.DOCTORSTableAdapter.Fill(Me.EbtblsDataSet1.DOCTORS)
'TODO: This line of code loads data into the 'Appointments._Appointments' table. You can move, or remove it, as needed.
'Me.AppointmentsTableAdapter1.Fill(Me.Appointments._Appointments)
'TODO: This line of code loads data into the 'EbtblsDataSet1.Appointments' table. You can move, or remove it, as needed.
Me.AppointmentsTableAdapter.Fill(Me.EbtblsDataSet1.Appointments)
'TODO: This line of code loads data into the 'Appointments._Appointments' table. You can move, or remove it, as needed.
'Me.AppointmentsTableAdapter.Fill(Me.Appointments._Appointments)
'TODO: This line of code loads data into the 'Appointments.AppTypes' table. You can move, or remove it, as needed.
' Me.AppTypesTableAdapter.Fill(Me.Appointments.AppTypes)
'TODO: This line of code loads data into the 'Appointments._Appointments' table. You can move, or remove it, as needed.
'Me.AppointmentsTableAdapter.Fill(Me.Appointments._Appointments)
'TODO: This line of code loads data into the 'EbtblsDataSet.DEMOGRAPHICS' table. You can move, or remove it, as needed.
'Me.DEMOGRAPHICSTableAdapter.Fill(Me.EbtblsDataSet.DEMOGRAPHICS)
'TODO: This line of code loads data into the 'NwindDataSet.Labels' table. You can move, or remove it, as needed.
'Positioning
With Me
Dim scr As Screen = Screen.PrimaryScreen
.Left = (scr.WorkingArea.Width - .Width) / 2
.Top = (scr.WorkingArea.Height - .Height) / 2
End With
Me.DOCTORSTableAdapter.Fill(EbtblsDataSet1.DOCTORS)
Me.AppointmentsTableAdapter.Fill(EbtblsDataSet1.Appointments)
' fill toolbar combobox with user names
For Each row As DataRow In Me.EbtblsDataSet1.DOCTORS
Dim owner As ScheduleOwner
owner = New ScheduleOwner(row)
Me.cmbDoctor.Items.Add(owner)
Next row
' select current user
If cmbDoctor.Items.Count > 0 Then
cmbDoctor.SelectedIndex = 0
End If
'With Me
' ' On form loading fill data adapters in order to load data from the database.
' DOCTORSTableAdapter.Fill(.EbtblsDataSet2.DOCTORS)
' AppointmentsTableAdapter.Fill(EbtblsDataSet1.Appointments)
' For Each row As DataRow In .EbtblsDataSet2.DOCTORS
' _doctor = New ScheduleOwner(row)
' .cmbDoctor.Items.Add(_doctor)
' Next row
'End With
End Sub
'Replace built-in AppointmentForm with MakeAppt
Private Sub c1Schedule1_BeforeAppointmentCreate(ByVal sender As Object, ByVal e As CancelEventArgs) Handles C1Schedule1.BeforeAppointmentCreate
' Don't show built-in form
e.Cancel = True
' Create new Appointment object with currently selected DateTime and default
Dim app As Appointment = C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add(C1Schedule1.CurrentDate, C1Schedule1.CalendarInfo.TimeScale)
' Create frmMakeAppt for the new appointment
Dim f As New TestSchedule.MakeAppt(C1Schedule1, app)
'Show(Form)
If f.ShowDialog() <> DialogResult.OK Then
'If user closes form without saving, remove appointment
app.Delete()
End If
End Sub
' Replace built-in AppointmentForm with the MakeAppt
Private Sub c1Schedule1_BeforeAppointmentShow(ByVal sender As Object, ByVal e As CancelAppointmentEventArgs) Handles C1Schedule1.BeforeAppointmentShow
' Don't show built-in form
e.Cancel = True
' Create frmMakeAppt for selected Appointment
Dim form As New TestSchedule.MakeAppt(C1Schedule1, e.Appointment)
' Show form
form.ShowDialog()
End Sub
'jarrod
Private Sub cmbdoctor_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbDoctor.SelectedIndexChanged
If cmbDoctor.SelectedIndex >= 0 Then
' get new owner
_doctor = cmbDoctor.SelectedItem
' apply filter to data source (show only current owner's appointments)
Dim v As IBindingListView
v = C1Schedule1.DataStorage.AppointmentStorage
C1Schedule1.BeginUpdate()
'If cmbDoctor.SelectedIndex > 0 Then
v.Filter = "Doctor='" + _doctor.Index.ToString() + "'"
' ' Set default value for Appointment table Owner column (equal to the current owner index)
Me.EbtblsDataSet1.Appointments.IDColumn.DefaultValue = _doctor.Index
'Else
' 'Turn off the filter entirely to view/print ALL appointments
' Me.EbtblsDataSet1.Appointments.DoctorColumn.DefaultValue = Nothing
' v.Filter = Nothing
'End If
C1Schedule1.EndUpdate()
End If
End Sub
Private Sub C1Schedule1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1Schedule1.Load
End Sub
Private Sub itmExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles itmExit.Click
Me.Close()
End Sub
End Class