2009-11-30 03:53:28 -05:00
using System ;
using System.Collections ;
2011-05-08 05:17:53 -04:00
using System.Collections.Generic ;
2009-11-30 03:53:28 -05:00
using System.ComponentModel ;
using System.Windows.Forms ;
using System.Diagnostics ;
using System.Data ;
using System.Threading ;
using IndianHealthService.BMXNet ;
2011-01-20 09:32:28 -05:00
using System.Runtime.InteropServices ;
2011-03-21 08:47:45 -04:00
using System.Drawing.Printing ;
2011-03-24 09:26:14 -04:00
using System.Linq ;
2009-11-30 03:53:28 -05:00
namespace IndianHealthService.ClinicalScheduling
{
/// <summary>
2011-01-17 09:25:48 -05:00
/// Main Form: Shows Tree of Clinics and Calendar Grid
2009-11-30 03:53:28 -05:00
/// </summary>
public class CGView : System . Windows . Forms . Form
{
private System . Windows . Forms . MainMenu mainMenu1 ;
private System . Windows . Forms . MenuItem mnuFile ;
private System . Windows . Forms . MenuItem mnuTest ;
private System . Windows . Forms . MenuItem mnuAppointment ;
private System . Windows . Forms . MenuItem mnuNewAppointment ;
private System . Windows . Forms . MenuItem mnu1Day ;
private System . Windows . Forms . MenuItem mnu7Day ;
private System . Windows . Forms . MenuItem menuItem4 ;
private System . Windows . Forms . MenuItem mnu5Day ;
private System . Windows . Forms . MenuItem mnu10Minute ;
private System . Windows . Forms . MenuItem mnu20Minute ;
private System . Windows . Forms . MenuItem mnu30Minute ;
private System . Windows . Forms . MenuItem mnuTimeScale ;
private System . Windows . Forms . MenuItem mnu15Minute ;
private System . Windows . Forms . MenuItem mnuOpenSchedule ;
private System . Windows . Forms . MenuItem menuItem1 ;
private System . Windows . Forms . TreeView tvSchedules ;
private System . Windows . Forms . MenuItem mnuViewScheduleTree ;
private System . Windows . Forms . MenuItem mnuDeleteAppointment ;
private System . Windows . Forms . MenuItem mnuTest1 ;
private System . Windows . Forms . Splitter splitter1 ;
private System . Windows . Forms . Splitter splitter2 ;
private System . Windows . Forms . StatusBar statusBar1 ;
private System . Windows . Forms . DateTimePicker dateTimePicker1 ;
private System . Windows . Forms . MenuItem mnuViewRightPanel ;
private System . Windows . Forms . Panel panelRight ;
private System . Windows . Forms . Panel panelTop ;
private System . Windows . Forms . Panel panelCenter ;
private System . Windows . Forms . Panel panelBottom ;
private System . Windows . Forms . Label lblResource ;
2011-05-08 05:17:53 -04:00
private System . Windows . Forms . ContextMenu ctxResourceTree ;
2009-11-30 03:53:28 -05:00
private System . Windows . Forms . MenuItem ctxOpenSchedule ;
private System . Windows . Forms . MenuItem ctxEditAvailability ;
private System . Windows . Forms . MenuItem ctxProperties ;
private System . Windows . Forms . MenuItem mnuSchedulingManagment ;
private System . Windows . Forms . MenuItem ctxFindAppt ;
private System . Windows . Forms . MenuItem mnuFindAppt ;
internal System . Windows . Forms . MenuItem mnuRPMSServer ;
internal System . Windows . Forms . MenuItem mnuRPMSLogin ;
private System . Windows . Forms . MenuItem mnuCheckIn ;
private System . Windows . Forms . MenuItem menuItem3 ;
private System . Windows . Forms . MenuItem mnuHelpAbout ;
private System . Windows . Forms . MenuItem mnuCalendar ;
private System . Windows . Forms . MenuItem mnuHelp ;
private System . Windows . Forms . MenuItem mnuClose ;
private System . Windows . Forms . MenuItem mnuViewPatientAppts ;
private IndianHealthService . ClinicalScheduling . CalendarGrid calendarGrid1 ;
private System . Windows . Forms . MenuItem mnuCopyAppointment ;
private System . Windows . Forms . Panel panelClip ;
private System . Windows . Forms . ListBox lstClip ;
private System . Windows . Forms . Label label1 ;
private System . Windows . Forms . ContextMenu ctxApptClipMenu ;
private System . Windows . Forms . MenuItem mnuRemoveClipItem ;
private System . Windows . Forms . MenuItem mnuClearClipItems ;
private System . Windows . Forms . MenuItem mnuEditAppointment ;
private System . Windows . Forms . ContextMenu ctxCalendarGrid ;
private System . Windows . Forms . MenuItem ctxCalGridAdd ;
private System . Windows . Forms . MenuItem ctxCalGridEdit ;
private System . Windows . Forms . MenuItem ctxCalGridDelete ;
private System . Windows . Forms . MenuItem ctxCalGridCheckIn ;
private System . Windows . Forms . MenuItem menuItem6 ;
private System . Windows . Forms . MenuItem menuItem7 ;
2010-06-04 22:19:48 -04:00
private System . Windows . Forms . MenuItem mnuPrintReminderLetters ;
2009-11-30 03:53:28 -05:00
private System . Windows . Forms . MenuItem mnuPrintPatientLetter ;
private System . Windows . Forms . MenuItem mnuPrintClinicSchedules ;
private System . Windows . Forms . MenuItem ctxCalGridNoShow ;
private System . Windows . Forms . MenuItem ctxCalGridNoShowUndo ;
private System . Windows . Forms . MenuItem mnuNoShow ;
private System . Windows . Forms . MenuItem mnuNoShowUndo ;
private System . Windows . Forms . MenuItem mnuPrintRebookLetters ;
private System . Windows . Forms . MenuItem mnuPrintCancellationLetters ;
private System . Windows . Forms . MenuItem mnuWalkIn ;
2011-05-08 05:17:53 -04:00
private System . Windows . Forms . MenuItem sepApptMenu1 ;
private System . Windows . Forms . MenuItem sepApptMenu2 ;
2009-11-30 03:53:28 -05:00
private System . Windows . Forms . MenuItem ctxCalGridWalkin ;
2011-05-08 05:17:53 -04:00
private System . Windows . Forms . MenuItem ctxCalGridSep1 ;
private System . Windows . Forms . MenuItem ctxCalGridSep2 ;
2009-11-30 03:53:28 -05:00
private System . Windows . Forms . MenuItem mnuOpenMultipleSchedules ;
private System . Windows . Forms . MenuItem mnuDisplayWalkIns ;
private System . Windows . Forms . MenuItem mnuRPMSDivision ;
2011-05-08 05:17:53 -04:00
private MenuItem ctxCalGridSep3 ;
2011-03-21 08:47:45 -04:00
private MenuItem ctxCalGridReprintApptSlip ;
2011-03-29 05:46:30 -04:00
private MenuItem ctxCalGridUndoCheckin ;
private MenuItem ctxPrintScheduleT0 ;
private MenuItem ctxPrintScheduleT1 ;
private MenuItem ctxPrintScheduleT3 ;
2011-03-30 06:54:56 -04:00
private MenuItem menuItem12 ;
private MenuItem mnuRefresh ;
2011-05-08 05:17:53 -04:00
private MenuItem ctxCalGridMkRadAppt ;
private MenuItem ctxCalGridCancelRadAppt ;
private MenuItem mnuMkRadAppt ;
private MenuItem mnuCancelRadAppt ;
private MenuItem mnuUndoCheckin ;
private MenuItem sepApptMenu3 ;
private MenuItem mnuReprintApptSlip ;
2009-11-30 03:53:28 -05:00
private IContainer components ;
#region Initialization
public CGView ( )
{
/ /
// Required for Windows Form Designer support
/ /
InitializeComponent ( ) ;
m_nSlots = 0 ;
m_alSelectedTreeResourceArray = new ArrayList ( ) ;
m_ClipList = new CGAppointments ( ) ;
}
public void InitializeDocView ( string sText )
{
this . Text = this . DocManager . ConnectInfo . UserName ;
if ( sText ! = null )
this . Text + = " - " + sText ;
if ( DocManager . ConnectInfo . DivisionName ! = null )
this . Text + = " - " + DocManager . ConnectInfo . DivisionName ;
}
public void InitializeDocView ( CGDocument doc ,
CGDocumentManager docMgr ,
DateTime dStartDate ,
string sText )
{
System . IntPtr pHandle = this . Handle ;
this . DocManager = docMgr ;
this . StartDate = dStartDate ;
this . Document = doc ;
2011-01-20 09:32:28 -05:00
//Rather strangely, this line is needed for God knows Why...
//Without it, the Grid tries to draw appointments, but can't.
//Making a constructor in the Calendar Grid itself didn't work. Don't know why.
//XXX: For later investigation.
this . Appointments = new CGAppointments ( ) ;
2010-07-04 01:25:13 -04:00
// Set username and division up top
this . Text = this . DocManager . ConnectInfo . UserName ;
2009-11-30 03:53:28 -05:00
if ( sText ! = null )
this . Text + = " - " + sText ;
if ( DocManager . ConnectInfo . DivisionName ! = null )
this . Text + = " - " + DocManager . ConnectInfo . DivisionName ;
this . m_ConnectInfo = m_DocManager . ConnectInfo ;
m_bmxDelegate = new BMXNetConnectInfo . BMXNetEventDelegate ( BMXNetEventHandler ) ;
m_ConnectInfo . BMXNetEvent + = m_bmxDelegate ;
}
private BMXNetConnectInfo . BMXNetEventDelegate m_bmxDelegate ;
2011-01-20 09:32:28 -05:00
2009-11-30 03:53:28 -05:00
#endregion initialization
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent ( )
{
this . components = new System . ComponentModel . Container ( ) ;
System . ComponentModel . ComponentResourceManager resources = new System . ComponentModel . ComponentResourceManager ( typeof ( CGView ) ) ;
this . mainMenu1 = new System . Windows . Forms . MainMenu ( this . components ) ;
this . mnuFile = new System . Windows . Forms . MenuItem ( ) ;
this . mnuOpenSchedule = new System . Windows . Forms . MenuItem ( ) ;
this . mnuOpenMultipleSchedules = new System . Windows . Forms . MenuItem ( ) ;
this . menuItem1 = new System . Windows . Forms . MenuItem ( ) ;
this . mnuRPMSServer = new System . Windows . Forms . MenuItem ( ) ;
this . mnuRPMSLogin = new System . Windows . Forms . MenuItem ( ) ;
this . mnuRPMSDivision = new System . Windows . Forms . MenuItem ( ) ;
this . menuItem3 = new System . Windows . Forms . MenuItem ( ) ;
this . mnuSchedulingManagment = new System . Windows . Forms . MenuItem ( ) ;
this . menuItem6 = new System . Windows . Forms . MenuItem ( ) ;
this . mnuPrintClinicSchedules = new System . Windows . Forms . MenuItem ( ) ;
2010-06-04 22:19:48 -04:00
this . mnuPrintReminderLetters = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . mnuPrintRebookLetters = new System . Windows . Forms . MenuItem ( ) ;
this . mnuPrintCancellationLetters = new System . Windows . Forms . MenuItem ( ) ;
this . mnuPrintPatientLetter = new System . Windows . Forms . MenuItem ( ) ;
this . menuItem7 = new System . Windows . Forms . MenuItem ( ) ;
this . mnuClose = new System . Windows . Forms . MenuItem ( ) ;
this . mnuAppointment = new System . Windows . Forms . MenuItem ( ) ;
this . mnuNewAppointment = new System . Windows . Forms . MenuItem ( ) ;
2011-05-08 05:17:53 -04:00
this . mnuWalkIn = new System . Windows . Forms . MenuItem ( ) ;
this . mnuMkRadAppt = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . mnuEditAppointment = new System . Windows . Forms . MenuItem ( ) ;
this . mnuDeleteAppointment = new System . Windows . Forms . MenuItem ( ) ;
2011-05-08 05:17:53 -04:00
this . mnuCancelRadAppt = new System . Windows . Forms . MenuItem ( ) ;
this . sepApptMenu1 = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . mnuNoShow = new System . Windows . Forms . MenuItem ( ) ;
this . mnuNoShowUndo = new System . Windows . Forms . MenuItem ( ) ;
2011-05-08 05:17:53 -04:00
this . sepApptMenu2 = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . mnuCheckIn = new System . Windows . Forms . MenuItem ( ) ;
2011-05-08 05:17:53 -04:00
this . mnuUndoCheckin = new System . Windows . Forms . MenuItem ( ) ;
this . sepApptMenu3 = new System . Windows . Forms . MenuItem ( ) ;
this . mnuFindAppt = new System . Windows . Forms . MenuItem ( ) ;
this . mnuCopyAppointment = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . mnuViewPatientAppts = new System . Windows . Forms . MenuItem ( ) ;
2011-05-08 05:17:53 -04:00
this . mnuReprintApptSlip = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . mnuCalendar = new System . Windows . Forms . MenuItem ( ) ;
this . mnuDisplayWalkIns = new System . Windows . Forms . MenuItem ( ) ;
this . mnu1Day = new System . Windows . Forms . MenuItem ( ) ;
this . mnu5Day = new System . Windows . Forms . MenuItem ( ) ;
this . mnu7Day = new System . Windows . Forms . MenuItem ( ) ;
this . menuItem4 = new System . Windows . Forms . MenuItem ( ) ;
this . mnuTimeScale = new System . Windows . Forms . MenuItem ( ) ;
this . mnu10Minute = new System . Windows . Forms . MenuItem ( ) ;
this . mnu15Minute = new System . Windows . Forms . MenuItem ( ) ;
this . mnu20Minute = new System . Windows . Forms . MenuItem ( ) ;
this . mnu30Minute = new System . Windows . Forms . MenuItem ( ) ;
this . mnuViewScheduleTree = new System . Windows . Forms . MenuItem ( ) ;
this . mnuViewRightPanel = new System . Windows . Forms . MenuItem ( ) ;
2011-03-30 06:54:56 -04:00
this . menuItem12 = new System . Windows . Forms . MenuItem ( ) ;
this . mnuRefresh = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . mnuHelp = new System . Windows . Forms . MenuItem ( ) ;
this . mnuHelpAbout = new System . Windows . Forms . MenuItem ( ) ;
this . mnuTest = new System . Windows . Forms . MenuItem ( ) ;
this . mnuTest1 = new System . Windows . Forms . MenuItem ( ) ;
this . tvSchedules = new System . Windows . Forms . TreeView ( ) ;
2011-05-08 05:17:53 -04:00
this . ctxResourceTree = new System . Windows . Forms . ContextMenu ( ) ;
2009-11-30 03:53:28 -05:00
this . ctxOpenSchedule = new System . Windows . Forms . MenuItem ( ) ;
this . ctxEditAvailability = new System . Windows . Forms . MenuItem ( ) ;
this . ctxProperties = new System . Windows . Forms . MenuItem ( ) ;
this . ctxFindAppt = new System . Windows . Forms . MenuItem ( ) ;
2011-03-29 05:46:30 -04:00
this . ctxPrintScheduleT0 = new System . Windows . Forms . MenuItem ( ) ;
this . ctxPrintScheduleT1 = new System . Windows . Forms . MenuItem ( ) ;
2011-03-30 04:19:15 -04:00
this . ctxPrintScheduleT3 = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . panelRight = new System . Windows . Forms . Panel ( ) ;
this . panelClip = new System . Windows . Forms . Panel ( ) ;
this . lstClip = new System . Windows . Forms . ListBox ( ) ;
this . ctxApptClipMenu = new System . Windows . Forms . ContextMenu ( ) ;
this . mnuRemoveClipItem = new System . Windows . Forms . MenuItem ( ) ;
this . mnuClearClipItems = new System . Windows . Forms . MenuItem ( ) ;
this . label1 = new System . Windows . Forms . Label ( ) ;
this . panelTop = new System . Windows . Forms . Panel ( ) ;
this . dateTimePicker1 = new System . Windows . Forms . DateTimePicker ( ) ;
this . lblResource = new System . Windows . Forms . Label ( ) ;
this . panelCenter = new System . Windows . Forms . Panel ( ) ;
2011-05-11 07:41:51 -04:00
this . calendarGrid1 = new IndianHealthService . ClinicalScheduling . CalendarGrid ( ) ;
2009-11-30 03:53:28 -05:00
this . ctxCalendarGrid = new System . Windows . Forms . ContextMenu ( ) ;
this . ctxCalGridAdd = new System . Windows . Forms . MenuItem ( ) ;
2011-05-08 05:17:53 -04:00
this . ctxCalGridMkRadAppt = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . ctxCalGridEdit = new System . Windows . Forms . MenuItem ( ) ;
this . ctxCalGridDelete = new System . Windows . Forms . MenuItem ( ) ;
2011-05-08 05:17:53 -04:00
this . ctxCalGridCancelRadAppt = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . ctxCalGridCheckIn = new System . Windows . Forms . MenuItem ( ) ;
2011-03-29 05:46:30 -04:00
this . ctxCalGridUndoCheckin = new System . Windows . Forms . MenuItem ( ) ;
2011-05-08 05:17:53 -04:00
this . ctxCalGridSep1 = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . ctxCalGridNoShow = new System . Windows . Forms . MenuItem ( ) ;
this . ctxCalGridNoShowUndo = new System . Windows . Forms . MenuItem ( ) ;
2011-05-08 05:17:53 -04:00
this . ctxCalGridSep2 = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . ctxCalGridWalkin = new System . Windows . Forms . MenuItem ( ) ;
2011-05-08 05:17:53 -04:00
this . ctxCalGridSep3 = new System . Windows . Forms . MenuItem ( ) ;
2011-03-21 08:47:45 -04:00
this . ctxCalGridReprintApptSlip = new System . Windows . Forms . MenuItem ( ) ;
2009-11-30 03:53:28 -05:00
this . panelBottom = new System . Windows . Forms . Panel ( ) ;
this . statusBar1 = new System . Windows . Forms . StatusBar ( ) ;
this . splitter1 = new System . Windows . Forms . Splitter ( ) ;
this . splitter2 = new System . Windows . Forms . Splitter ( ) ;
this . panelRight . SuspendLayout ( ) ;
this . panelClip . SuspendLayout ( ) ;
this . panelTop . SuspendLayout ( ) ;
this . panelCenter . SuspendLayout ( ) ;
this . panelBottom . SuspendLayout ( ) ;
this . SuspendLayout ( ) ;
//
// mainMenu1
//
this . mainMenu1 . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] {
this . mnuFile ,
this . mnuAppointment ,
this . mnuCalendar ,
this . mnuHelp ,
this . mnuTest } ) ;
//
// mnuFile
//
this . mnuFile . Index = 0 ;
this . mnuFile . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] {
this . mnuOpenSchedule ,
this . mnuOpenMultipleSchedules ,
this . menuItem1 ,
this . mnuRPMSServer ,
this . mnuRPMSLogin ,
this . mnuRPMSDivision ,
this . menuItem3 ,
this . mnuSchedulingManagment ,
this . menuItem6 ,
this . mnuPrintClinicSchedules ,
2010-06-04 22:19:48 -04:00
this . mnuPrintReminderLetters ,
2009-11-30 03:53:28 -05:00
this . mnuPrintRebookLetters ,
this . mnuPrintCancellationLetters ,
this . mnuPrintPatientLetter ,
this . menuItem7 ,
this . mnuClose } ) ;
this . mnuFile . Text = "&File" ;
this . mnuFile . Popup + = new System . EventHandler ( this . mnuFile_Popup ) ;
//
// mnuOpenSchedule
//
this . mnuOpenSchedule . Enabled = false ;
this . mnuOpenSchedule . Index = 0 ;
this . mnuOpenSchedule . Text = "&Open Schedule" ;
this . mnuOpenSchedule . Visible = false ;
this . mnuOpenSchedule . Click + = new System . EventHandler ( this . mnuOpenSchedule_Click ) ;
//
// mnuOpenMultipleSchedules
//
this . mnuOpenMultipleSchedules . Index = 1 ;
2010-06-10 17:20:08 -04:00
this . mnuOpenMultipleSchedules . Shortcut = System . Windows . Forms . Shortcut . CtrlM ;
2009-11-30 03:53:28 -05:00
this . mnuOpenMultipleSchedules . Text = "Open M&ultiple Schedules" ;
this . mnuOpenMultipleSchedules . Click + = new System . EventHandler ( this . mnuOpenMultipleSchedules_Click ) ;
//
// menuItem1
//
this . menuItem1 . Index = 2 ;
this . menuItem1 . Text = "-" ;
//
// mnuRPMSServer
//
this . mnuRPMSServer . Index = 3 ;
2011-01-19 09:02:59 -05:00
this . mnuRPMSServer . Shortcut = System . Windows . Forms . Shortcut . CtrlShiftS ;
2009-12-04 03:04:47 -05:00
this . mnuRPMSServer . Text = "Change VistA &Server" ;
2009-11-30 03:53:28 -05:00
this . mnuRPMSServer . Click + = new System . EventHandler ( this . mnuRPMSServer_Click ) ;
//
// mnuRPMSLogin
//
this . mnuRPMSLogin . Index = 4 ;
2011-01-19 09:02:59 -05:00
this . mnuRPMSLogin . Shortcut = System . Windows . Forms . Shortcut . CtrlShiftL ;
2009-12-04 03:04:47 -05:00
this . mnuRPMSLogin . Text = "Change VistA &Login" ;
2009-11-30 03:53:28 -05:00
this . mnuRPMSLogin . Click + = new System . EventHandler ( this . mnuRPMSLogin_Click ) ;
//
// mnuRPMSDivision
//
this . mnuRPMSDivision . Index = 5 ;
2011-01-19 09:02:59 -05:00
this . mnuRPMSDivision . Shortcut = System . Windows . Forms . Shortcut . CtrlShiftD ;
2009-12-04 03:04:47 -05:00
this . mnuRPMSDivision . Text = "Change VistA &Division" ;
2009-11-30 03:53:28 -05:00
this . mnuRPMSDivision . Click + = new System . EventHandler ( this . mnuRPMSDivision_Click ) ;
//
// menuItem3
//
this . menuItem3 . Index = 6 ;
this . menuItem3 . Text = "-" ;
//
// mnuSchedulingManagment
//
this . mnuSchedulingManagment . Index = 7 ;
2010-06-04 22:19:48 -04:00
this . mnuSchedulingManagment . Shortcut = System . Windows . Forms . Shortcut . CtrlShiftM ;
2009-11-30 03:53:28 -05:00
this . mnuSchedulingManagment . Text = "Scheduling &Management" ;
this . mnuSchedulingManagment . Click + = new System . EventHandler ( this . mnuSchedulingManagment_Click ) ;
//
// menuItem6
//
this . menuItem6 . Index = 8 ;
this . menuItem6 . Text = "-" ;
//
// mnuPrintClinicSchedules
//
this . mnuPrintClinicSchedules . Index = 9 ;
2010-05-21 21:03:45 -04:00
this . mnuPrintClinicSchedules . Shortcut = System . Windows . Forms . Shortcut . CtrlP ;
2009-11-30 03:53:28 -05:00
this . mnuPrintClinicSchedules . Text = "&Print Clinic Schedules" ;
this . mnuPrintClinicSchedules . Click + = new System . EventHandler ( this . mnuPrintClinicSchedules_Click ) ;
//
2010-06-04 22:19:48 -04:00
// mnuPrintReminderLetters
2009-11-30 03:53:28 -05:00
//
2010-06-04 22:19:48 -04:00
this . mnuPrintReminderLetters . Index = 10 ;
2011-05-08 05:17:53 -04:00
this . mnuPrintReminderLetters . Shortcut = System . Windows . Forms . Shortcut . CtrlE ;
2010-06-04 22:19:48 -04:00
this . mnuPrintReminderLetters . Text = "Print Rem&inder Letters" ;
this . mnuPrintReminderLetters . Click + = new System . EventHandler ( this . mnuPrintReminderLetters_Click ) ;
2009-11-30 03:53:28 -05:00
//
// mnuPrintRebookLetters
//
this . mnuPrintRebookLetters . Index = 11 ;
2010-07-11 10:09:11 -04:00
this . mnuPrintRebookLetters . Shortcut = System . Windows . Forms . Shortcut . CtrlR ;
2009-11-30 03:53:28 -05:00
this . mnuPrintRebookLetters . Text = "Print &Rebook Letters" ;
this . mnuPrintRebookLetters . Click + = new System . EventHandler ( this . mnuPrintRebookLetters_Click ) ;
//
// mnuPrintCancellationLetters
//
this . mnuPrintCancellationLetters . Index = 12 ;
2010-06-04 22:19:48 -04:00
this . mnuPrintCancellationLetters . Shortcut = System . Windows . Forms . Shortcut . CtrlShiftC ;
2009-11-30 03:53:28 -05:00
this . mnuPrintCancellationLetters . Text = "Print C&ancellation Letters" ;
this . mnuPrintCancellationLetters . Click + = new System . EventHandler ( this . mnuPrintCancellationLetters_Click ) ;
//
// mnuPrintPatientLetter
//
this . mnuPrintPatientLetter . Index = 13 ;
2010-06-06 20:59:53 -04:00
this . mnuPrintPatientLetter . Shortcut = System . Windows . Forms . Shortcut . CtrlL ;
2009-11-30 03:53:28 -05:00
this . mnuPrintPatientLetter . Text = "Print Patient Le&tter" ;
this . mnuPrintPatientLetter . Click + = new System . EventHandler ( this . mnuPrintPatientLetter_Click ) ;
//
// menuItem7
//
this . menuItem7 . Index = 14 ;
this . menuItem7 . Text = "-" ;
//
// mnuClose
//
this . mnuClose . Index = 15 ;
2010-06-06 20:59:53 -04:00
this . mnuClose . Shortcut = System . Windows . Forms . Shortcut . CtrlW ;
2009-11-30 03:53:28 -05:00
this . mnuClose . Text = "&Close Schedule" ;
this . mnuClose . Click + = new System . EventHandler ( this . mnuClose_Click ) ;
//
// mnuAppointment
//
this . mnuAppointment . Index = 1 ;
this . mnuAppointment . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] {
this . mnuNewAppointment ,
2011-05-08 05:17:53 -04:00
this . mnuWalkIn ,
this . mnuMkRadAppt ,
2009-11-30 03:53:28 -05:00
this . mnuEditAppointment ,
this . mnuDeleteAppointment ,
2011-05-08 05:17:53 -04:00
this . mnuCancelRadAppt ,
this . sepApptMenu1 ,
2009-11-30 03:53:28 -05:00
this . mnuNoShow ,
this . mnuNoShowUndo ,
2011-05-08 05:17:53 -04:00
this . sepApptMenu2 ,
2009-11-30 03:53:28 -05:00
this . mnuCheckIn ,
2011-05-08 05:17:53 -04:00
this . mnuUndoCheckin ,
this . sepApptMenu3 ,
this . mnuFindAppt ,
this . mnuCopyAppointment ,
this . mnuViewPatientAppts ,
this . mnuReprintApptSlip } ) ;
2009-11-30 03:53:28 -05:00
this . mnuAppointment . Text = "&Appointment" ;
this . mnuAppointment . Popup + = new System . EventHandler ( this . mnuAppointment_Popup ) ;
//
// mnuNewAppointment
//
this . mnuNewAppointment . Index = 0 ;
2011-04-14 08:33:14 -04:00
this . mnuNewAppointment . Shortcut = System . Windows . Forms . Shortcut . Ins ;
2009-11-30 03:53:28 -05:00
this . mnuNewAppointment . Text = "&New Appointment" ;
this . mnuNewAppointment . Click + = new System . EventHandler ( this . mnuNewAppointment_Click ) ;
//
2011-05-08 05:17:53 -04:00
// mnuWalkIn
//
this . mnuWalkIn . Index = 1 ;
this . mnuWalkIn . Shortcut = System . Windows . Forms . Shortcut . ShiftIns ;
this . mnuWalkIn . Text = "Create Wal&k-In Appointment" ;
this . mnuWalkIn . Click + = new System . EventHandler ( this . mnuWalkIn_Click ) ;
//
// mnuMkRadAppt
//
this . mnuMkRadAppt . Index = 2 ;
this . mnuMkRadAppt . Shortcut = System . Windows . Forms . Shortcut . CtrlIns ;
this . mnuMkRadAppt . Text = "Make Radiology Appointment" ;
this . mnuMkRadAppt . Click + = new System . EventHandler ( this . mnuMkRadAppt_Click ) ;
//
2009-11-30 03:53:28 -05:00
// mnuEditAppointment
//
2011-05-08 05:17:53 -04:00
this . mnuEditAppointment . Index = 3 ;
2011-04-14 08:33:14 -04:00
this . mnuEditAppointment . Shortcut = System . Windows . Forms . Shortcut . F2 ;
2009-11-30 03:53:28 -05:00
this . mnuEditAppointment . Text = "&Edit Appointment" ;
this . mnuEditAppointment . Click + = new System . EventHandler ( this . mnuEditAppointment_Click ) ;
//
// mnuDeleteAppointment
//
2011-05-08 05:17:53 -04:00
this . mnuDeleteAppointment . Index = 4 ;
2011-04-14 08:33:14 -04:00
this . mnuDeleteAppointment . Shortcut = System . Windows . Forms . Shortcut . Del ;
2009-11-30 03:53:28 -05:00
this . mnuDeleteAppointment . Text = "Cance&l Appointment" ;
this . mnuDeleteAppointment . Click + = new System . EventHandler ( this . mnuDeleteAppointment_Click ) ;
//
2011-05-08 05:17:53 -04:00
// mnuCancelRadAppt
//
this . mnuCancelRadAppt . Index = 5 ;
this . mnuCancelRadAppt . Shortcut = System . Windows . Forms . Shortcut . CtrlDel ;
this . mnuCancelRadAppt . Text = "Cancel Radiology Appointment" ;
this . mnuCancelRadAppt . Click + = new System . EventHandler ( this . mnuCancelRadAppt_Click ) ;
//
// sepApptMenu1
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
this . sepApptMenu1 . Index = 6 ;
this . sepApptMenu1 . Text = "-" ;
2009-11-30 03:53:28 -05:00
//
// mnuNoShow
//
2011-05-08 05:17:53 -04:00
this . mnuNoShow . Index = 7 ;
this . mnuNoShow . Shortcut = System . Windows . Forms . Shortcut . CtrlN ;
2009-11-30 03:53:28 -05:00
this . mnuNoShow . Text = "Mark as No Sho&w" ;
this . mnuNoShow . Click + = new System . EventHandler ( this . mnuNoShow_Click ) ;
//
// mnuNoShowUndo
//
2011-05-08 05:17:53 -04:00
this . mnuNoShowUndo . Index = 8 ;
this . mnuNoShowUndo . Shortcut = System . Windows . Forms . Shortcut . CtrlShiftN ;
2009-11-30 03:53:28 -05:00
this . mnuNoShowUndo . Text = "&Undo No Show" ;
this . mnuNoShowUndo . Click + = new System . EventHandler ( this . mnuNoShowUndo_Click ) ;
//
2011-05-08 05:17:53 -04:00
// sepApptMenu2
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
this . sepApptMenu2 . Index = 9 ;
this . sepApptMenu2 . Text = "-" ;
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
// mnuCheckIn
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
this . mnuCheckIn . Index = 10 ;
this . mnuCheckIn . Shortcut = System . Windows . Forms . Shortcut . CtrlI ;
this . mnuCheckIn . Text = "Check &In Patient" ;
this . mnuCheckIn . Click + = new System . EventHandler ( this . mnuCheckIn_Click ) ;
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
// mnuUndoCheckin
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
this . mnuUndoCheckin . Index = 11 ;
this . mnuUndoCheckin . Shortcut = System . Windows . Forms . Shortcut . CtrlShiftI ;
this . mnuUndoCheckin . Text = "Undo Checkin" ;
this . mnuUndoCheckin . Click + = new System . EventHandler ( this . mnuUndoCheckin_Click ) ;
//
// sepApptMenu3
//
this . sepApptMenu3 . Index = 12 ;
this . sepApptMenu3 . Text = "-" ;
2009-11-30 03:53:28 -05:00
//
// mnuFindAppt
//
2011-05-08 05:17:53 -04:00
this . mnuFindAppt . Index = 13 ;
2011-03-30 04:19:15 -04:00
this . mnuFindAppt . Shortcut = System . Windows . Forms . Shortcut . CtrlF ;
2011-04-14 08:33:14 -04:00
this . mnuFindAppt . Text = "&Find Empty Slots" ;
2009-11-30 03:53:28 -05:00
this . mnuFindAppt . Click + = new System . EventHandler ( this . mnuFindAppt_Click ) ;
//
2011-05-08 05:17:53 -04:00
// mnuCopyAppointment
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
this . mnuCopyAppointment . Index = 14 ;
this . mnuCopyAppointment . Shortcut = System . Windows . Forms . Shortcut . CtrlC ;
this . mnuCopyAppointment . Text = "&Copy Appointment to Clipboard" ;
this . mnuCopyAppointment . Click + = new System . EventHandler ( this . mnuCopyAppointment_Click ) ;
2009-11-30 03:53:28 -05:00
//
// mnuViewPatientAppts
//
2011-05-08 05:17:53 -04:00
this . mnuViewPatientAppts . Index = 15 ;
this . mnuViewPatientAppts . Shortcut = System . Windows . Forms . Shortcut . CtrlShiftZ ;
2009-11-30 03:53:28 -05:00
this . mnuViewPatientAppts . Text = "&View Patient Appointments" ;
this . mnuViewPatientAppts . Click + = new System . EventHandler ( this . mnuViewPatientAppts_Click ) ;
//
2011-05-08 05:17:53 -04:00
// mnuReprintApptSlip
//
this . mnuReprintApptSlip . Index = 16 ;
this . mnuReprintApptSlip . Shortcut = System . Windows . Forms . Shortcut . CtrlShiftP ;
this . mnuReprintApptSlip . Text = "Reprint Appointment Slip" ;
this . mnuReprintApptSlip . Click + = new System . EventHandler ( this . mnuReprintApptSlip_Click ) ;
//
2009-11-30 03:53:28 -05:00
// mnuCalendar
//
this . mnuCalendar . Index = 2 ;
this . mnuCalendar . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] {
this . mnuDisplayWalkIns ,
this . mnu1Day ,
this . mnu5Day ,
this . mnu7Day ,
this . menuItem4 ,
this . mnuTimeScale ,
this . mnuViewScheduleTree ,
2011-03-30 06:54:56 -04:00
this . mnuViewRightPanel ,
this . menuItem12 ,
this . mnuRefresh } ) ;
2009-11-30 03:53:28 -05:00
this . mnuCalendar . Text = "&View" ;
//
// mnuDisplayWalkIns
//
this . mnuDisplayWalkIns . Checked = true ;
this . mnuDisplayWalkIns . Index = 0 ;
2011-05-08 05:17:53 -04:00
this . mnuDisplayWalkIns . Shortcut = System . Windows . Forms . Shortcut . F12 ;
2009-11-30 03:53:28 -05:00
this . mnuDisplayWalkIns . Text = "&Display Walk-Ins" ;
this . mnuDisplayWalkIns . Click + = new System . EventHandler ( this . mnuDisplayWalkIns_Click ) ;
//
// mnu1Day
//
this . mnu1Day . Index = 1 ;
2010-06-10 17:20:08 -04:00
this . mnu1Day . Shortcut = System . Windows . Forms . Shortcut . Ctrl1 ;
2009-11-30 03:53:28 -05:00
this . mnu1Day . Text = "&1-Day View" ;
this . mnu1Day . Click + = new System . EventHandler ( this . mnu1Day_Click ) ;
//
// mnu5Day
//
this . mnu5Day . Index = 2 ;
2010-06-10 17:20:08 -04:00
this . mnu5Day . Shortcut = System . Windows . Forms . Shortcut . Ctrl5 ;
2009-11-30 03:53:28 -05:00
this . mnu5Day . Text = "&5-Day View" ;
this . mnu5Day . Click + = new System . EventHandler ( this . mnu5Day_Click ) ;
//
// mnu7Day
//
this . mnu7Day . Index = 3 ;
2010-06-10 17:20:08 -04:00
this . mnu7Day . Shortcut = System . Windows . Forms . Shortcut . Ctrl7 ;
2009-11-30 03:53:28 -05:00
this . mnu7Day . Text = "&7-Day View" ;
this . mnu7Day . Click + = new System . EventHandler ( this . mnu7Day_Click ) ;
//
// menuItem4
//
this . menuItem4 . Index = 4 ;
this . menuItem4 . Text = "-" ;
//
// mnuTimeScale
//
this . mnuTimeScale . Index = 5 ;
this . mnuTimeScale . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] {
this . mnu10Minute ,
this . mnu15Minute ,
this . mnu20Minute ,
this . mnu30Minute } ) ;
this . mnuTimeScale . Text = "&Time Scale" ;
//
// mnu10Minute
//
2011-03-30 04:19:15 -04:00
this . mnu10Minute . Enabled = false ;
2009-11-30 03:53:28 -05:00
this . mnu10Minute . Index = 0 ;
2010-06-10 17:20:08 -04:00
this . mnu10Minute . Shortcut = System . Windows . Forms . Shortcut . Ctrl0 ;
2009-11-30 03:53:28 -05:00
this . mnu10Minute . Text = "&10-Minute" ;
this . mnu10Minute . Click + = new System . EventHandler ( this . mnu10Minute_Click ) ;
//
// mnu15Minute
//
2011-03-30 04:19:15 -04:00
this . mnu15Minute . Enabled = false ;
2009-11-30 03:53:28 -05:00
this . mnu15Minute . Index = 1 ;
2010-06-10 17:20:08 -04:00
this . mnu15Minute . Shortcut = System . Windows . Forms . Shortcut . Ctrl4 ;
2009-11-30 03:53:28 -05:00
this . mnu15Minute . Text = "1&5-Minute" ;
this . mnu15Minute . Click + = new System . EventHandler ( this . mnu15Minute_Click ) ;
//
// mnu20Minute
//
2011-03-30 04:19:15 -04:00
this . mnu20Minute . Enabled = false ;
2009-11-30 03:53:28 -05:00
this . mnu20Minute . Index = 2 ;
2010-06-10 17:20:08 -04:00
this . mnu20Minute . Shortcut = System . Windows . Forms . Shortcut . Ctrl3 ;
2009-11-30 03:53:28 -05:00
this . mnu20Minute . Text = "&20-Minute" ;
this . mnu20Minute . Click + = new System . EventHandler ( this . mnu20Minute_Click ) ;
//
// mnu30Minute
//
2011-03-30 04:19:15 -04:00
this . mnu30Minute . Enabled = false ;
2009-11-30 03:53:28 -05:00
this . mnu30Minute . Index = 3 ;
2010-06-10 17:20:08 -04:00
this . mnu30Minute . Shortcut = System . Windows . Forms . Shortcut . Ctrl2 ;
2009-11-30 03:53:28 -05:00
this . mnu30Minute . Text = "&30-Minute" ;
this . mnu30Minute . Click + = new System . EventHandler ( this . mnu30Minute_Click ) ;
//
// mnuViewScheduleTree
//
2011-05-08 05:17:53 -04:00
this . mnuViewScheduleTree . Checked = true ;
2009-11-30 03:53:28 -05:00
this . mnuViewScheduleTree . Index = 6 ;
2011-05-08 05:17:53 -04:00
this . mnuViewScheduleTree . Shortcut = System . Windows . Forms . Shortcut . F4 ;
2009-11-30 03:53:28 -05:00
this . mnuViewScheduleTree . Text = "&Schedule Tree" ;
this . mnuViewScheduleTree . Click + = new System . EventHandler ( this . mnuViewScheduleTree_Click ) ;
//
// mnuViewRightPanel
//
this . mnuViewRightPanel . Index = 7 ;
this . mnuViewRightPanel . Text = "&Appointment Clipboard" ;
this . mnuViewRightPanel . Click + = new System . EventHandler ( this . mnuViewRightPanel_Click ) ;
//
2011-03-30 06:54:56 -04:00
// menuItem12
//
this . menuItem12 . Index = 8 ;
this . menuItem12 . Text = "-" ;
//
// mnuRefresh
//
this . mnuRefresh . Index = 9 ;
this . mnuRefresh . Shortcut = System . Windows . Forms . Shortcut . F5 ;
this . mnuRefresh . Text = "Refresh Data" ;
this . mnuRefresh . Click + = new System . EventHandler ( this . mnuRefresh_Click ) ;
//
2009-11-30 03:53:28 -05:00
// mnuHelp
//
this . mnuHelp . Index = 3 ;
this . mnuHelp . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] {
this . mnuHelpAbout } ) ;
this . mnuHelp . Text = "&Help" ;
//
// mnuHelpAbout
//
this . mnuHelpAbout . Index = 0 ;
this . mnuHelpAbout . Text = "&About" ;
this . mnuHelpAbout . Click + = new System . EventHandler ( this . mnuHelpAbout_Click ) ;
//
// mnuTest
//
this . mnuTest . Enabled = false ;
this . mnuTest . Index = 4 ;
this . mnuTest . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] {
this . mnuTest1 } ) ;
this . mnuTest . Text = "&Test" ;
this . mnuTest . Visible = false ;
//
// mnuTest1
//
this . mnuTest1 . Index = 0 ;
this . mnuTest1 . Text = "Test1" ;
this . mnuTest1 . Click + = new System . EventHandler ( this . mnuTest1_Click ) ;
//
// tvSchedules
//
this . tvSchedules . BackColor = System . Drawing . SystemColors . ControlLight ;
2011-05-08 05:17:53 -04:00
this . tvSchedules . ContextMenu = this . ctxResourceTree ;
2009-11-30 03:53:28 -05:00
this . tvSchedules . Dock = System . Windows . Forms . DockStyle . Left ;
this . tvSchedules . HotTracking = true ;
this . tvSchedules . Location = new System . Drawing . Point ( 0 , 0 ) ;
this . tvSchedules . Name = "tvSchedules" ;
2011-05-08 05:17:53 -04:00
this . tvSchedules . Size = new System . Drawing . Size ( 128 , 392 ) ;
2009-11-30 03:53:28 -05:00
this . tvSchedules . Sorted = true ;
this . tvSchedules . TabIndex = 1 ;
2010-11-24 01:42:07 -05:00
this . tvSchedules . AfterSelect + = new System . Windows . Forms . TreeViewEventHandler ( this . tvSchedules_AfterSelect ) ;
2011-03-20 03:22:11 -04:00
this . tvSchedules . NodeMouseClick + = new System . Windows . Forms . TreeNodeMouseClickEventHandler ( this . tvSchedules_NodeMouseClick ) ;
2010-11-24 01:42:07 -05:00
this . tvSchedules . DoubleClick + = new System . EventHandler ( this . tvSchedules_DoubleClick ) ;
2011-03-20 03:22:11 -04:00
this . tvSchedules . MouseEnter + = new System . EventHandler ( this . tvSchedules_MouseEnter ) ;
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
// ctxResourceTree
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
this . ctxResourceTree . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] {
2009-11-30 03:53:28 -05:00
this . ctxOpenSchedule ,
this . ctxEditAvailability ,
this . ctxProperties ,
2011-03-29 05:46:30 -04:00
this . ctxFindAppt ,
this . ctxPrintScheduleT0 ,
this . ctxPrintScheduleT1 ,
this . ctxPrintScheduleT3 } ) ;
2011-05-08 05:17:53 -04:00
this . ctxResourceTree . Popup + = new System . EventHandler ( this . contextMenu1_Popup ) ;
2009-11-30 03:53:28 -05:00
//
// ctxOpenSchedule
//
this . ctxOpenSchedule . DefaultItem = true ;
this . ctxOpenSchedule . Index = 0 ;
this . ctxOpenSchedule . Text = "&Open Schedule" ;
this . ctxOpenSchedule . Click + = new System . EventHandler ( this . ctxOpenSchedule_Click ) ;
//
// ctxEditAvailability
//
this . ctxEditAvailability . Index = 1 ;
this . ctxEditAvailability . Text = "&Edit Resource Availability" ;
this . ctxEditAvailability . Click + = new System . EventHandler ( this . ctxEditAvailability_Click ) ;
//
// ctxProperties
//
this . ctxProperties . Index = 2 ;
2011-03-29 05:46:30 -04:00
this . ctxProperties . Text = "P&roperties" ;
2009-11-30 03:53:28 -05:00
this . ctxProperties . Click + = new System . EventHandler ( this . ctxProperties_Click ) ;
//
// ctxFindAppt
//
this . ctxFindAppt . Index = 3 ;
2011-04-14 08:33:14 -04:00
this . ctxFindAppt . Text = "&Find Empty Slots" ;
2009-11-30 03:53:28 -05:00
this . ctxFindAppt . Click + = new System . EventHandler ( this . ctxFindAppt_Click ) ;
//
2011-03-29 05:46:30 -04:00
// ctxPrintScheduleT0
//
this . ctxPrintScheduleT0 . Index = 4 ;
this . ctxPrintScheduleT0 . Text = "Print Clinic Schedule(s) (T+&0)" ;
this . ctxPrintScheduleT0 . Click + = new System . EventHandler ( this . ctxPrintScheduleT0_Click ) ;
//
// ctxPrintScheduleT1
//
this . ctxPrintScheduleT1 . Index = 5 ;
this . ctxPrintScheduleT1 . Text = "Print Clinic Schedule(s) (T+&1)" ;
this . ctxPrintScheduleT1 . Click + = new System . EventHandler ( this . ctxPrintScheduleT1_Click ) ;
//
2011-03-30 04:19:15 -04:00
// ctxPrintScheduleT3
//
this . ctxPrintScheduleT3 . Index = 6 ;
this . ctxPrintScheduleT3 . Text = "Print Clinic Schedule(s) (T+&3)" ;
this . ctxPrintScheduleT3 . Click + = new System . EventHandler ( this . ctxPrintScheduleT3_Click ) ;
//
2009-11-30 03:53:28 -05:00
// panelRight
//
this . panelRight . Controls . Add ( this . panelClip ) ;
this . panelRight . Dock = System . Windows . Forms . DockStyle . Right ;
2011-03-20 03:22:11 -04:00
this . panelRight . Location = new System . Drawing . Point ( 996 , 0 ) ;
2009-11-30 03:53:28 -05:00
this . panelRight . Name = "panelRight" ;
2011-05-08 05:17:53 -04:00
this . panelRight . Size = new System . Drawing . Size ( 128 , 392 ) ;
2009-11-30 03:53:28 -05:00
this . panelRight . TabIndex = 3 ;
this . panelRight . Visible = false ;
//
// panelClip
//
this . panelClip . Controls . Add ( this . lstClip ) ;
this . panelClip . Controls . Add ( this . label1 ) ;
this . panelClip . Dock = System . Windows . Forms . DockStyle . Top ;
this . panelClip . Location = new System . Drawing . Point ( 0 , 0 ) ;
this . panelClip . Name = "panelClip" ;
this . panelClip . Size = new System . Drawing . Size ( 128 , 448 ) ;
this . panelClip . TabIndex = 0 ;
//
// lstClip
//
this . lstClip . AllowDrop = true ;
this . lstClip . ContextMenu = this . ctxApptClipMenu ;
this . lstClip . DisplayMember = "PatientName" ;
this . lstClip . Dock = System . Windows . Forms . DockStyle . Fill ;
this . lstClip . Location = new System . Drawing . Point ( 0 , 32 ) ;
this . lstClip . Name = "lstClip" ;
2010-11-24 01:42:07 -05:00
this . lstClip . Size = new System . Drawing . Size ( 128 , 416 ) ;
2009-11-30 03:53:28 -05:00
this . lstClip . TabIndex = 0 ;
this . lstClip . SelectedIndexChanged + = new System . EventHandler ( this . lstClip_SelectedIndexChanged ) ;
this . lstClip . DragDrop + = new System . Windows . Forms . DragEventHandler ( this . lstClip_DragDrop ) ;
this . lstClip . DragEnter + = new System . Windows . Forms . DragEventHandler ( this . lstClip_DragEnter ) ;
2010-11-24 01:42:07 -05:00
this . lstClip . MouseDown + = new System . Windows . Forms . MouseEventHandler ( this . lstClip_MouseDown ) ;
this . lstClip . MouseMove + = new System . Windows . Forms . MouseEventHandler ( this . lstClip_MouseMove ) ;
2009-11-30 03:53:28 -05:00
//
// ctxApptClipMenu
//
this . ctxApptClipMenu . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] {
this . mnuRemoveClipItem ,
this . mnuClearClipItems } ) ;
this . ctxApptClipMenu . Popup + = new System . EventHandler ( this . ctxApptClipMenu_Popup ) ;
//
// mnuRemoveClipItem
//
this . mnuRemoveClipItem . Index = 0 ;
this . mnuRemoveClipItem . Text = "Remove Item" ;
this . mnuRemoveClipItem . Click + = new System . EventHandler ( this . mnuRemoveClipItem_Click ) ;
//
// mnuClearClipItems
//
this . mnuClearClipItems . Index = 1 ;
this . mnuClearClipItems . Text = "Clear All" ;
this . mnuClearClipItems . Click + = new System . EventHandler ( this . mnuClearClipItems_Click ) ;
//
// label1
//
this . label1 . Dock = System . Windows . Forms . DockStyle . Top ;
this . label1 . Location = new System . Drawing . Point ( 0 , 0 ) ;
this . label1 . Name = "label1" ;
this . label1 . Size = new System . Drawing . Size ( 128 , 32 ) ;
this . label1 . TabIndex = 1 ;
this . label1 . Text = "Appointment Clipboard" ;
this . label1 . TextAlign = System . Drawing . ContentAlignment . BottomCenter ;
//
// panelTop
//
this . panelTop . Controls . Add ( this . dateTimePicker1 ) ;
this . panelTop . Controls . Add ( this . lblResource ) ;
this . panelTop . Dock = System . Windows . Forms . DockStyle . Top ;
this . panelTop . Location = new System . Drawing . Point ( 128 , 0 ) ;
this . panelTop . Name = "panelTop" ;
2011-03-20 03:22:11 -04:00
this . panelTop . Size = new System . Drawing . Size ( 868 , 24 ) ;
2009-11-30 03:53:28 -05:00
this . panelTop . TabIndex = 6 ;
//
// dateTimePicker1
//
this . dateTimePicker1 . Dock = System . Windows . Forms . DockStyle . Right ;
this . dateTimePicker1 . DropDownAlign = System . Windows . Forms . LeftRightAlignment . Right ;
2011-03-20 03:22:11 -04:00
this . dateTimePicker1 . Location = new System . Drawing . Point ( 662 , 0 ) ;
2009-11-30 03:53:28 -05:00
this . dateTimePicker1 . Name = "dateTimePicker1" ;
2011-03-03 04:44:18 -05:00
this . dateTimePicker1 . Size = new System . Drawing . Size ( 206 , 20 ) ;
2009-11-30 03:53:28 -05:00
this . dateTimePicker1 . TabIndex = 1 ;
2011-01-16 05:41:21 -05:00
this . dateTimePicker1 . CloseUp + = new System . EventHandler ( this . dateTimePicker1_CloseUp ) ;
this . dateTimePicker1 . KeyPress + = new System . Windows . Forms . KeyPressEventHandler ( this . dateTimePicker1_KeyPress ) ;
this . dateTimePicker1 . Leave + = new System . EventHandler ( this . dateTimePicker1_Leave ) ;
2009-11-30 03:53:28 -05:00
//
// lblResource
//
this . lblResource . Font = new System . Drawing . Font ( "Microsoft Sans Serif" , 12F , System . Drawing . FontStyle . Bold , System . Drawing . GraphicsUnit . Point , ( ( byte ) ( 0 ) ) ) ;
this . lblResource . ForeColor = System . Drawing . SystemColors . Highlight ;
this . lblResource . Location = new System . Drawing . Point ( 8 , 5 ) ;
this . lblResource . Name = "lblResource" ;
this . lblResource . Size = new System . Drawing . Size ( 456 , 19 ) ;
this . lblResource . TabIndex = 2 ;
//
// panelCenter
//
this . panelCenter . Controls . Add ( this . calendarGrid1 ) ;
this . panelCenter . Dock = System . Windows . Forms . DockStyle . Fill ;
this . panelCenter . Location = new System . Drawing . Point ( 136 , 24 ) ;
this . panelCenter . Name = "panelCenter" ;
2011-05-08 05:17:53 -04:00
this . panelCenter . Size = new System . Drawing . Size ( 857 , 344 ) ;
2009-11-30 03:53:28 -05:00
this . panelCenter . TabIndex = 7 ;
//
2011-05-11 07:41:51 -04:00
// calendarGrid1
//
this . calendarGrid1 . AllowDrop = true ;
this . calendarGrid1 . Appointments = null ;
this . calendarGrid1 . ApptDragSource = null ;
this . calendarGrid1 . AutoScroll = true ;
this . calendarGrid1 . AutoScrollMinSize = new System . Drawing . Size ( 600 , 1898 ) ;
this . calendarGrid1 . AvailabilityArray = null ;
this . calendarGrid1 . BackColor = System . Drawing . SystemColors . Window ;
this . calendarGrid1 . Columns = 5 ;
this . calendarGrid1 . ContextMenu = this . ctxCalendarGrid ;
this . calendarGrid1 . Dock = System . Windows . Forms . DockStyle . Fill ;
this . calendarGrid1 . DrawWalkIns = true ;
this . calendarGrid1 . GridBackColor = null ;
this . calendarGrid1 . GridEnter = false ;
this . calendarGrid1 . Location = new System . Drawing . Point ( 0 , 0 ) ;
this . calendarGrid1 . Name = "calendarGrid1" ;
this . calendarGrid1 . Resources = ( ( System . Collections . ArrayList ) ( resources . GetObject ( "calendarGrid1.Resources" ) ) ) ;
this . calendarGrid1 . SelectedAppointment = 0 ;
this . calendarGrid1 . Size = new System . Drawing . Size ( 857 , 344 ) ;
this . calendarGrid1 . StartDate = new System . DateTime ( 2003 , 1 , 27 , 0 , 0 , 0 , 0 ) ;
this . calendarGrid1 . TabIndex = 0 ;
this . calendarGrid1 . TimeScale = 20 ;
this . calendarGrid1 . CGAppointmentChanged + = new IndianHealthService . ClinicalScheduling . CalendarGrid . CGAppointmentChangedHandler ( this . calendarGrid1_CGAppointmentChanged ) ;
this . calendarGrid1 . CGAppointmentAdded + = new IndianHealthService . ClinicalScheduling . CalendarGrid . CGAppointmentChangedHandler ( this . calendarGrid1_CGAppointmentAdded ) ;
this . calendarGrid1 . CGSelectionChanged + = new IndianHealthService . ClinicalScheduling . CalendarGrid . CGSelectionChangedHandler ( this . calendarGrid1_CGSelectionChanged ) ;
this . calendarGrid1 . DoubleClick + = new System . EventHandler ( this . calendarGrid1_DoubleClick ) ;
this . calendarGrid1 . MouseEnter + = new System . EventHandler ( this . calendarGrid1_MouseEnter ) ;
//
2009-11-30 03:53:28 -05:00
// ctxCalendarGrid
//
this . ctxCalendarGrid . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] {
this . ctxCalGridAdd ,
2011-05-08 05:17:53 -04:00
this . ctxCalGridMkRadAppt ,
2009-11-30 03:53:28 -05:00
this . ctxCalGridEdit ,
this . ctxCalGridDelete ,
2011-05-08 05:17:53 -04:00
this . ctxCalGridCancelRadAppt ,
2009-11-30 03:53:28 -05:00
this . ctxCalGridCheckIn ,
2011-03-29 05:46:30 -04:00
this . ctxCalGridUndoCheckin ,
2011-05-08 05:17:53 -04:00
this . ctxCalGridSep1 ,
2009-11-30 03:53:28 -05:00
this . ctxCalGridNoShow ,
this . ctxCalGridNoShowUndo ,
2011-05-08 05:17:53 -04:00
this . ctxCalGridSep2 ,
2010-06-19 12:41:06 -04:00
this . ctxCalGridWalkin ,
2011-05-08 05:17:53 -04:00
this . ctxCalGridSep3 ,
2011-03-21 08:47:45 -04:00
this . ctxCalGridReprintApptSlip } ) ;
2009-11-30 03:53:28 -05:00
this . ctxCalendarGrid . Popup + = new System . EventHandler ( this . ctxCalendarGrid_Popup ) ;
//
// ctxCalGridAdd
//
this . ctxCalGridAdd . Index = 0 ;
this . ctxCalGridAdd . Text = "Add Appointment" ;
this . ctxCalGridAdd . Click + = new System . EventHandler ( this . ctxCalGridAdd_Click ) ;
//
2011-05-08 05:17:53 -04:00
// ctxCalGridMkRadAppt
//
this . ctxCalGridMkRadAppt . Index = 1 ;
this . ctxCalGridMkRadAppt . Text = "Make Radiology Appointment" ;
this . ctxCalGridMkRadAppt . Click + = new System . EventHandler ( this . ctxCalGridMkRadAppt_Click ) ;
//
2009-11-30 03:53:28 -05:00
// ctxCalGridEdit
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridEdit . Index = 2 ;
2009-11-30 03:53:28 -05:00
this . ctxCalGridEdit . Text = "Edit Appointment" ;
this . ctxCalGridEdit . Click + = new System . EventHandler ( this . ctxCalGridEdit_Click ) ;
//
// ctxCalGridDelete
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridDelete . Index = 3 ;
2009-11-30 03:53:28 -05:00
this . ctxCalGridDelete . Text = "Cancel Appointment" ;
this . ctxCalGridDelete . Click + = new System . EventHandler ( this . ctxCalGridDelete_Click ) ;
//
2011-05-08 05:17:53 -04:00
// ctxCalGridCancelRadAppt
//
this . ctxCalGridCancelRadAppt . Index = 4 ;
this . ctxCalGridCancelRadAppt . Text = "Cancel Radiology Appointment" ;
this . ctxCalGridCancelRadAppt . Click + = new System . EventHandler ( this . ctxCalGridCancelRadAppt_Click ) ;
//
2009-11-30 03:53:28 -05:00
// ctxCalGridCheckIn
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridCheckIn . Index = 5 ;
2009-11-30 03:53:28 -05:00
this . ctxCalGridCheckIn . Text = "Check In Patient" ;
this . ctxCalGridCheckIn . Click + = new System . EventHandler ( this . ctxCalGridCheckIn_Click ) ;
//
2011-03-29 05:46:30 -04:00
// ctxCalGridUndoCheckin
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridUndoCheckin . Index = 6 ;
2011-03-29 05:46:30 -04:00
this . ctxCalGridUndoCheckin . Text = "&Undo Check In" ;
this . ctxCalGridUndoCheckin . Click + = new System . EventHandler ( this . ctxCalGridUndoCheckin_Click ) ;
//
2011-05-08 05:17:53 -04:00
// ctxCalGridSep1
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridSep1 . Index = 7 ;
this . ctxCalGridSep1 . Text = "-" ;
2009-11-30 03:53:28 -05:00
//
// ctxCalGridNoShow
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridNoShow . Index = 8 ;
2009-11-30 03:53:28 -05:00
this . ctxCalGridNoShow . Text = "Mark as No Show" ;
this . ctxCalGridNoShow . Click + = new System . EventHandler ( this . ctxCalGridNoShow_Click ) ;
//
// ctxCalGridNoShowUndo
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridNoShowUndo . Index = 9 ;
2009-11-30 03:53:28 -05:00
this . ctxCalGridNoShowUndo . Text = "Undo NoShow" ;
this . ctxCalGridNoShowUndo . Click + = new System . EventHandler ( this . ctxCalGridNoShowUndo_Click ) ;
//
2011-05-08 05:17:53 -04:00
// ctxCalGridSep2
2009-11-30 03:53:28 -05:00
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridSep2 . Index = 10 ;
this . ctxCalGridSep2 . Text = "-" ;
2009-11-30 03:53:28 -05:00
//
// ctxCalGridWalkin
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridWalkin . Index = 11 ;
2009-11-30 03:53:28 -05:00
this . ctxCalGridWalkin . Text = "Create Wal&k-In Appointment" ;
this . ctxCalGridWalkin . Click + = new System . EventHandler ( this . ctxCalGridWalkin_Click ) ;
//
2011-05-08 05:17:53 -04:00
// ctxCalGridSep3
2010-06-19 12:41:06 -04:00
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridSep3 . Index = 12 ;
this . ctxCalGridSep3 . Text = "-" ;
2010-06-19 12:41:06 -04:00
//
2011-03-21 08:47:45 -04:00
// ctxCalGridReprintApptSlip
2010-07-04 01:25:13 -04:00
//
2011-05-08 05:17:53 -04:00
this . ctxCalGridReprintApptSlip . Index = 13 ;
2011-03-21 08:47:45 -04:00
this . ctxCalGridReprintApptSlip . Text = "&Reprint Appointment Slip" ;
this . ctxCalGridReprintApptSlip . Click + = new System . EventHandler ( this . ctxCalGridReprintApptSlip_Click ) ;
2010-07-04 01:25:13 -04:00
//
2009-11-30 03:53:28 -05:00
// panelBottom
//
this . panelBottom . Controls . Add ( this . statusBar1 ) ;
this . panelBottom . Dock = System . Windows . Forms . DockStyle . Bottom ;
2011-05-08 05:17:53 -04:00
this . panelBottom . Location = new System . Drawing . Point ( 136 , 368 ) ;
2009-11-30 03:53:28 -05:00
this . panelBottom . Name = "panelBottom" ;
2011-03-20 03:22:11 -04:00
this . panelBottom . Size = new System . Drawing . Size ( 857 , 24 ) ;
2009-11-30 03:53:28 -05:00
this . panelBottom . TabIndex = 8 ;
//
// statusBar1
//
this . statusBar1 . Dock = System . Windows . Forms . DockStyle . Fill ;
this . statusBar1 . Location = new System . Drawing . Point ( 0 , 0 ) ;
this . statusBar1 . Name = "statusBar1" ;
2011-03-20 03:22:11 -04:00
this . statusBar1 . Size = new System . Drawing . Size ( 857 , 24 ) ;
2009-11-30 03:53:28 -05:00
this . statusBar1 . SizingGrip = false ;
this . statusBar1 . TabIndex = 0 ;
//
// splitter1
//
this . splitter1 . Location = new System . Drawing . Point ( 128 , 24 ) ;
this . splitter1 . Name = "splitter1" ;
2011-05-08 05:17:53 -04:00
this . splitter1 . Size = new System . Drawing . Size ( 8 , 368 ) ;
2009-11-30 03:53:28 -05:00
this . splitter1 . TabIndex = 9 ;
this . splitter1 . TabStop = false ;
//
// splitter2
//
this . splitter2 . Dock = System . Windows . Forms . DockStyle . Right ;
2011-03-20 03:22:11 -04:00
this . splitter2 . Location = new System . Drawing . Point ( 993 , 24 ) ;
2009-11-30 03:53:28 -05:00
this . splitter2 . Name = "splitter2" ;
2011-05-08 05:17:53 -04:00
this . splitter2 . Size = new System . Drawing . Size ( 3 , 368 ) ;
2009-11-30 03:53:28 -05:00
this . splitter2 . TabIndex = 10 ;
this . splitter2 . TabStop = false ;
//
// CGView
//
this . AutoScaleBaseSize = new System . Drawing . Size ( 5 , 13 ) ;
2011-05-08 05:17:53 -04:00
this . ClientSize = new System . Drawing . Size ( 1124 , 392 ) ;
2009-11-30 03:53:28 -05:00
this . Controls . Add ( this . panelCenter ) ;
this . Controls . Add ( this . panelBottom ) ;
this . Controls . Add ( this . splitter2 ) ;
this . Controls . Add ( this . splitter1 ) ;
this . Controls . Add ( this . panelTop ) ;
this . Controls . Add ( this . panelRight ) ;
this . Controls . Add ( this . tvSchedules ) ;
this . Icon = ( ( System . Drawing . Icon ) ( resources . GetObject ( "$this.Icon" ) ) ) ;
this . Menu = this . mainMenu1 ;
this . Name = "CGView" ;
this . StartPosition = System . Windows . Forms . FormStartPosition . CenterParent ;
this . Text = "CGView" ;
this . Activated + = new System . EventHandler ( this . CGView_Activated ) ;
this . Closing + = new System . ComponentModel . CancelEventHandler ( this . CGView_Closing ) ;
2010-11-24 01:42:07 -05:00
this . Load + = new System . EventHandler ( this . CGView_Load ) ;
this . CursorChanged + = new System . EventHandler ( this . CGView_CursorChanged ) ;
2009-11-30 03:53:28 -05:00
this . panelRight . ResumeLayout ( false ) ;
this . panelClip . ResumeLayout ( false ) ;
this . panelTop . ResumeLayout ( false ) ;
this . panelCenter . ResumeLayout ( false ) ;
this . panelBottom . ResumeLayout ( false ) ;
this . ResumeLayout ( false ) ;
}
#endregion
#region Fields
private CGDocument m_Document ;
private CGDocumentManager m_DocManager ;
private int m_nSlots ;
private ArrayList m_alSelectedTreeResourceArray = new ArrayList ( ) ;
private string m_sDocName ;
private CGAppointments m_ClipList ;
private bool m_bDragDropStart = false ;
private Hashtable m_htOverbook ;
private Hashtable m_htModifySchedule ;
private Hashtable m_htChangeAppts ;
private BMXNetConnectInfo m_ConnectInfo = null ;
public BMXNetConnectInfo . BMXNetEventDelegate BMXNetEvent ;
#endregion Fields
#region Properties
/// <summary>
/// Access the CalendarGrid associated with this view
/// </summary>
public CalendarGrid CGrid
{
get
{
return this . calendarGrid1 ;
}
}
/// <summary>
/// Accesses the document associated with this view
/// </summary>
public CGDocument Document
{
get
{
return this . m_Document ;
}
set
{
this . m_Document = value ;
}
}
public CGDocumentManager DocManager
{
get
{
return m_DocManager ;
}
set
{
m_DocManager = value ;
}
}
public DateTime StartDate
{
get
{
return this . calendarGrid1 . StartDate ;
}
set
{
this . calendarGrid1 . StartDate = value ;
}
}
public CGAppointments Appointments
{
get
{
return this . calendarGrid1 . Appointments ;
}
set
{
this . calendarGrid1 . Appointments = value ;
}
}
#endregion
#region AppointmentMenu Handlers
private void mnuAppointment_Popup ( object sender , System . EventArgs e )
{
2011-05-08 05:17:53 -04:00
// our flags
bool _findApptsEnabled = ( this . Document . Resources . Count > 0 ) ? true : false ;
bool _addApptsEnabled = AddAppointmentEnabled ( ) ;
bool _editApptsEnabled = EditAppointmentEnabled ( ) ;
bool _isRadAppt = IsThisARadiologyResource ( ) ;
bool _noShowEnabled = NoShowEnabled ( ) ;
bool _undoCheckinEnabled = UndoCheckinEnabled ( ) ;
//end flags
mnuNewAppointment . Enabled = _addApptsEnabled & & ! _isRadAppt ;
mnuWalkIn . Enabled = _addApptsEnabled & & ! _isRadAppt ;
mnuMkRadAppt . Enabled = _isRadAppt & & _addApptsEnabled ;
mnuEditAppointment . Enabled = _editApptsEnabled & & ! _isRadAppt ;
mnuDeleteAppointment . Enabled = _editApptsEnabled & & ! _isRadAppt ;
mnuCancelRadAppt . Enabled = _isRadAppt & & _editApptsEnabled ;
mnuNoShow . Enabled = _noShowEnabled & & _editApptsEnabled ;
mnuNoShowUndo . Enabled = ! _noShowEnabled & & _editApptsEnabled ;
mnuCheckIn . Enabled = _editApptsEnabled & & ! _isRadAppt ;
mnuUndoCheckin . Enabled = _undoCheckinEnabled & & ! _isRadAppt ;
mnuFindAppt . Enabled = _findApptsEnabled ;
mnuCopyAppointment . Enabled = _editApptsEnabled & & ! _isRadAppt ;
mnuViewPatientAppts . Enabled = true ;
mnuReprintApptSlip . Enabled = _editApptsEnabled ;
2009-11-30 03:53:28 -05:00
}
private void mnuCheckIn_Click ( object sender , System . EventArgs e )
{
AppointmentCheckIn ( ) ;
}
private void mnuCopyAppointment_Click ( object sender , System . EventArgs e )
{
//For each appointment in the grid's selected list,
//add to the clip list
//and add to m_ClipList
try
{
foreach ( CGAppointment a in this . calendarGrid1 . SelectedAppointments . AppointmentTable . Values )
{
2011-05-08 05:17:53 -04:00
if ( m_ClipList . AppointmentTable . Contains ( ( int ) a . AppointmentKey ) )
2009-11-30 03:53:28 -05:00
{
return ;
}
m_ClipList . AddAppointment ( a ) ;
2011-05-08 05:17:53 -04:00
lstClip . Items . Add ( a ) ;
2009-11-30 03:53:28 -05:00
}
}
catch ( Exception ex )
{
string s = ex . Message ;
Debug . Write ( s ) ;
return ;
}
}
private void mnuDeleteAppointment_Click ( object sender , System . EventArgs e )
{
AppointmentDelete ( ) ;
}
private void mnuEditAppointment_Click ( object sender , System . EventArgs e )
{
AppointmentEdit ( ) ;
}
private void mnuNewAppointment_Click ( object sender , System . EventArgs e )
{
AppointmentAddNew ( ) ;
}
private void mnuNoShow_Click ( object sender , System . EventArgs e )
{
AppointmentNoShow ( true ) ;
}
private void mnuNoShowUndo_Click ( object sender , System . EventArgs e )
{
AppointmentNoShow ( false ) ;
}
2011-03-29 05:46:30 -04:00
private void ctxCalGridUndoCheckin_Click ( object sender , EventArgs e )
{
AppointmentUndoCheckin ( ) ;
}
2011-05-08 05:17:53 -04:00
private void mnuMkRadAppt_Click ( object sender , EventArgs e )
{
AppointmentAddNewRadiology ( ) ;
}
private void mnuCancelRadAppt_Click ( object sender , EventArgs e )
{
AppointmentDeleteOneRadiology ( ) ;
}
private void mnuUndoCheckin_Click ( object sender , EventArgs e )
{
AppointmentUndoCheckin ( ) ;
}
private void mnuReprintApptSlip_Click ( object sender , EventArgs e )
{
int apptID = this . CGrid . SelectedAppointment ;
if ( apptID < = 0 ) return ;
CGAppointment a = ( CGAppointment ) this . Appointments . AppointmentTable [ apptID ] ;
PrintAppointmentSlip ( a ) ;
}
2009-11-30 03:53:28 -05:00
#endregion AppointmentMenu Handlers
#region ContextMenu1 Handlers
private void contextMenu1_Popup ( object sender , System . EventArgs e )
{
//Enable/disable OpenSchedule and Find Appointment options
bool bEnabled = ( m_alSelectedTreeResourceArray . Count > 0 ) ? true : false ;
this . ctxOpenSchedule . Enabled = bEnabled ;
this . ctxFindAppt . Enabled = bEnabled ;
2011-03-29 05:46:30 -04:00
this . ctxPrintScheduleT0 . Enabled = bEnabled ;
this . ctxPrintScheduleT1 . Enabled = bEnabled ;
this . ctxPrintScheduleT3 . Enabled = bEnabled ;
2009-11-30 03:53:28 -05:00
//properties not supported now
this . ctxProperties . Enabled = false ;
this . ctxProperties . Visible = false ;
//Enable/disable Availability menu option
if ( m_alSelectedTreeResourceArray . Count ! = 1 )
{
this . ctxEditAvailability . Enabled = false ;
return ;
}
if ( this . DocManager . ScheduleManager = = true )
{
ctxEditAvailability . Enabled = true ;
return ;
}
string sResource = ( string ) m_alSelectedTreeResourceArray [ 0 ] ;
DataTable dt = this . DocManager . GlobalDataSet . Tables [ "ResourceUser" ] ;
DataView dv = new DataView ( dt , "" , "RESOURCENAME ASC" , DataViewRowState . OriginalRows ) ;
string sDuz = this . DocManager . ConnectInfo . DUZ ;
bool bModSchedule = false ;
DataRowView [ ] drvA = dv . FindRows ( sResource ) ;
if ( drvA . Length = = 0 )
{
this . ctxEditAvailability . Enabled = false ;
}
else
{
string sModSchedule = "NO" ;
foreach ( DataRowView drv in drvA )
{
if ( drv [ "USERID" ] . ToString ( ) = = sDuz )
{
sModSchedule = drv [ "MODIFY_SCHEDULE" ] . ToString ( ) ;
break ;
}
}
bModSchedule = ( sModSchedule = = "YES" ) ? true : false ;
this . ctxEditAvailability . Enabled = bModSchedule ;
}
}
private void ctxEditAvailability_Click ( object sender , System . EventArgs e )
{
this . EditScheduleAvailability ( ) ;
}
private void ctxOpenSchedule_Click ( object sender , System . EventArgs e )
{
OpenSelectedSchedule ( m_alSelectedTreeResourceArray , DateTime . Today ) ;
}
2011-03-29 05:46:30 -04:00
private void ctxPrintScheduleT0_Click ( object sender , EventArgs e )
{
PrintClinicSchedule ( DateTime . Today , DateTime . Today ) ;
}
private void ctxPrintScheduleT1_Click ( object sender , EventArgs e )
{
PrintClinicSchedule ( DateTime . Today . AddDays ( 1 ) , DateTime . Today . AddDays ( 1 ) ) ;
}
private void ctxPrintScheduleT3_Click ( object sender , EventArgs e )
{
PrintClinicSchedule ( DateTime . Today . AddDays ( 3 ) , DateTime . Today . AddDays ( 3 ) ) ;
}
2009-11-30 03:53:28 -05:00
private void ctxProperties_Click ( object sender , System . EventArgs e )
{
//TODO: Implement Properties dialog
MessageBox . Show ( "TODO: Implement Properties dialog" ) ;
}
private void ctxFindAppt_Click ( object sender , System . EventArgs e )
{
FindAvailableAppointment ( m_alSelectedTreeResourceArray ) ;
}
#endregion ContextMenu1 Handlers
#region ctxApptClipMenu Handlers
private void mnuClearClipItems_Click ( object sender , System . EventArgs e )
{
this . m_ClipList . ClearAllAppointments ( ) ;
lstClip . Items . Clear ( ) ;
}
private void mnuRemoveClipItem_Click ( object sender , System . EventArgs e )
{
int i = lstClip . SelectedIndex ;
CGAppointment a = ( CGAppointment ) lstClip . SelectedItem ;
int nKey = a . AppointmentKey ;
if ( i > - 1 )
{
m_ClipList . RemoveAppointment ( nKey ) ;
lstClip . Items . RemoveAt ( i ) ;
}
}
private void ctxApptClipMenu_Popup ( object sender , System . EventArgs e )
{
mnuClearClipItems . Enabled = ( m_ClipList . AppointmentTable . Count > 0 ) ;
mnuRemoveClipItem . Enabled = ( lstClip . SelectedIndex > - 1 ) ;
}
#endregion ctxApptClipMenu Handlers
#region ctxCalGridMenu Handlers
private void ctxCalendarGrid_Popup ( object sender , System . EventArgs e )
{
2011-05-11 07:41:51 -04:00
// our flags
bool _findApptsEnabled = ( this . Document . Resources . Count > 0 ) ? true : false ;
bool _addApptsEnabled = AddAppointmentEnabled ( ) ;
bool _editApptsEnabled = EditAppointmentEnabled ( ) ;
bool _isRadAppt = IsThisARadiologyResource ( ) ;
bool _noShowEnabled = NoShowEnabled ( ) ;
bool _undoCheckinEnabled = UndoCheckinEnabled ( ) ;
//end flags
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
if ( _isRadAppt ) //this is a radiology resource
2011-05-08 05:17:53 -04:00
{
ctxCalGridAdd . Visible = false ;
ctxCalGridDelete . Visible = false ;
ctxCalGridEdit . Visible = false ;
ctxCalGridCheckIn . Visible = false ;
ctxCalGridNoShow . Visible = false ;
ctxCalGridNoShowUndo . Visible = false ;
ctxCalGridWalkin . Visible = false ;
ctxCalGridUndoCheckin . Visible = false ;
ctxCalGridSep1 . Visible = false ;
ctxCalGridSep2 . Visible = false ;
ctxCalGridMkRadAppt . Visible = true ;
ctxCalGridCancelRadAppt . Visible = true ;
}
else // this is a normal resource
{
ctxCalGridAdd . Visible = true ;
ctxCalGridDelete . Visible = true ;
ctxCalGridEdit . Visible = true ;
ctxCalGridCheckIn . Visible = true ;
ctxCalGridNoShow . Visible = true ;
ctxCalGridNoShowUndo . Visible = true ;
ctxCalGridWalkin . Visible = true ;
ctxCalGridUndoCheckin . Visible = true ;
ctxCalGridSep1 . Visible = true ;
ctxCalGridSep2 . Visible = true ;
ctxCalGridMkRadAppt . Visible = false ;
ctxCalGridCancelRadAppt . Visible = false ;
}
2011-05-11 07:41:51 -04:00
//Toggle availability of make, edit, checkin and delete appointments etc
2009-11-30 03:53:28 -05:00
//based on whether appropriate element is selected.
2011-05-11 07:41:51 -04:00
ctxCalGridAdd . Enabled = _addApptsEnabled & & ! _isRadAppt ;
ctxCalGridWalkin . Enabled = _addApptsEnabled & & ! _isRadAppt ;
ctxCalGridEdit . Enabled = _editApptsEnabled & & ! _isRadAppt ; ;
ctxCalGridDelete . Enabled = _editApptsEnabled & & ! _isRadAppt ;
ctxCalGridCheckIn . Enabled = _editApptsEnabled & & ! _isRadAppt ;
ctxCalGridUndoCheckin . Enabled = _undoCheckinEnabled & & ! _isRadAppt ;
ctxCalGridNoShow . Enabled = _noShowEnabled & & _editApptsEnabled ;
ctxCalGridNoShowUndo . Enabled = ! _noShowEnabled & & _editApptsEnabled ;
ctxCalGridReprintApptSlip . Enabled = _editApptsEnabled ;
2011-05-08 05:17:53 -04:00
//if the rad ones are visible, then these apply
2011-05-11 07:41:51 -04:00
ctxCalGridMkRadAppt . Enabled = _isRadAppt & & _addApptsEnabled ;
ctxCalGridCancelRadAppt . Enabled = _isRadAppt & & _editApptsEnabled ;
2010-06-19 12:41:06 -04:00
}
2009-11-30 03:53:28 -05:00
private void ctxCalGridAdd_Click ( object sender , System . EventArgs e )
{
AppointmentAddNew ( ) ;
}
private void calendarGrid1_DoubleClick ( object sender , System . EventArgs e )
{
if ( calendarGrid1 . SelectedAppointment > 0 )
AppointmentEdit ( ) ;
}
private void ctxCalGridEdit_Click ( object sender , System . EventArgs e )
{
AppointmentEdit ( ) ;
}
private void ctxCalGridDelete_Click ( object sender , System . EventArgs e )
{
AppointmentDelete ( ) ;
}
private void ctxCalGridCheckIn_Click ( object sender , System . EventArgs e )
{
AppointmentCheckIn ( ) ;
}
private void ctxCalGridNoShow_Click ( object sender , System . EventArgs e )
{
AppointmentNoShow ( true ) ;
}
private void ctxCalGridNoShowUndo_Click ( object sender , System . EventArgs e )
{
AppointmentNoShow ( false ) ;
}
2011-05-08 05:17:53 -04:00
private void ctxCalGridMkRadAppt_Click ( object sender , EventArgs e )
{
AppointmentAddNewRadiology ( ) ;
}
private void ctxCalGridCancelRadAppt_Click ( object sender , EventArgs e )
{
AppointmentDeleteOneRadiology ( ) ;
}
2011-03-21 08:47:45 -04:00
private void ctxCalGridReprintApptSlip_Click ( object sender , EventArgs e )
2010-06-19 12:41:06 -04:00
{
2011-03-21 08:47:45 -04:00
int apptID = this . CGrid . SelectedAppointment ;
if ( apptID < = 0 ) return ;
CGAppointment a = ( CGAppointment ) this . Appointments . AppointmentTable [ apptID ] ;
2011-03-23 05:15:51 -04:00
PrintAppointmentSlip ( a ) ;
2010-06-19 12:41:06 -04:00
}
2009-11-30 03:53:28 -05:00
#endregion ctxCalGridMenu Handlers
#region Methods
2011-05-08 05:17:53 -04:00
/// <summary>
/// Decides whether this is a Radiology Resource. Local Helper to decide what menu items to enable/display
/// </summary>
/// <returns></returns>
private bool IsThisARadiologyResource ( )
{
//I don't like this logic!!! but works for now!
//Note: I use banana peeling model below
//If no cell is selected AND no appointment is selected, then it's false
if ( this . calendarGrid1 . SelectedRange . Cells . CellCount < 1 & & this . calendarGrid1 . SelectedAppointment < 1 )
return false ;
//If an appointment is selected then...
if ( this . calendarGrid1 . SelectedAppointment > 0 )
{
CGAppointment appt = this . Appointments . AppointmentTable [ this . calendarGrid1 . SelectedAppointment ] as CGAppointment ;
if ( appt = = null ) return false ; //appt doesn't exist; old appointment and grid wasn't refreshed yet
if ( appt . RadiologyExamIEN . HasValue & & appt . RadiologyExamIEN . Value > 0 ) return true ; //this appointment is a radiology appointment since it has that member
else return false ;
}
//Otherwise, we are for sure dealing with a cell.
//We need to determine if the cell resource is mapped to a Radiology Hospital Location.
DateTime dStart ;
DateTime dEnd ;
string sResource ;
// Get resource
bool bRet = this . calendarGrid1 . GetSelectedTime ( out dStart , out dEnd , out sResource ) ;
// If we fail, return false (but this is not supposed to ever happen)
if ( bRet = = false )
{
return false ;
}
// see if resource is mapped to a Radiology Hospital Location.
return IsThisARadiologyResource ( sResource ) ;
}
private bool IsThisARadiologyResource ( string sResource )
{
// see if resource is mapped to a Radiology Hospital Location.
return ( //select all Hospital Locations which are radiology locations
from hl in CGDocumentManager . Current . GlobalDataSet . Tables [ "HospitalLocation" ] . AsEnumerable ( )
where hl . Field < string > ( "IS_RADIOLOGY_LOCATION" ) = = "1"
//join this to the resources table using the foreign ID (plain jane relational join)
join res in CGDocumentManager . Current . GlobalDataSet . Tables [ "Resources" ] . AsEnumerable ( )
on hl . Field < int > ( "HOSPITAL_LOCATION_ID" ) equals res . Field < int > ( "HOSPITAL_LOCATION_ID" )
//then filter this down to the resource that we have
where res . Field < string > ( "RESOURCE_NAME" ) = = sResource
//if we have any row left, then it is true.
select hl ) . Any ( ) ;
}
2009-11-30 03:53:28 -05:00
private bool EditAppointmentEnabled ( )
{
try
{
//Call here if there is a selected appointment in the grid
if ( calendarGrid1 . SelectedAppointment < 1 )
return false ;
CGAppointment appt = ( CGAppointment ) this . Appointments . AppointmentTable [ calendarGrid1 . SelectedAppointment ] ;
string sResource = appt . Resource ;
return EditAppointmentEnabled ( sResource ) ;
}
catch ( Exception ex )
{
string sMsg = ex . Message ;
return false ;
}
}
private bool EditAppointmentEnabled ( string sResource )
{
bool bManager = this . DocManager . ScheduleManager ;
if ( bManager = = true )
{
return ( true ) ;
}
else
{
bool bModAppts ;
bModAppts = ( bool ) this . m_htChangeAppts [ sResource ] ;
return bModAppts ;
}
}
private bool AddAppointmentEnabled ( )
{
if ( this . calendarGrid1 . SelectedRange . Cells . CellCount < 1 )
return false ;
bool bManager = this . DocManager . ScheduleManager ;
if ( bManager = = true )
{
return ( true ) ;
}
else
{
DateTime dStart = DateTime . Today ;
DateTime dEnd = DateTime . Today ;
string sResource = "" ;
bool bRet = this . calendarGrid1 . GetSelectedTime ( out dStart , out dEnd , out sResource ) ;
if ( bRet = = false )
{
return false ;
}
bool bSlotsAvailable ;
bool bOverbook ;
bool bModSchedule ;
bool bModAppts ;
bOverbook = ( bool ) this . m_htOverbook [ sResource ] ;
bModSchedule = ( bool ) this . m_htModifySchedule [ sResource ] ;
bModAppts = ( bool ) this . m_htChangeAppts [ sResource ] ;
if ( bModAppts = = false )
return false ;
2011-05-11 07:41:51 -04:00
CGAvailability resultantAvail ;
m_nSlots = m_Document . SlotsAvailable ( dStart , dEnd , sResource , this . calendarGrid1 . TimeScale , out resultantAvail ) ;
2009-11-30 03:53:28 -05:00
bSlotsAvailable = ( this . m_nSlots > 0 ) ;
return ( ( bSlotsAvailable ) | | ( bModSchedule ) | | ( bOverbook ) ) ;
}
}
2011-03-29 05:46:30 -04:00
private bool NoShowEnabled ( )
{
if ( calendarGrid1 . SelectedAppointment < 1 )
return false ;
CGAppointment appt = ( CGAppointment ) this . Appointments . AppointmentTable [ calendarGrid1 . SelectedAppointment ] ;
return ! appt . NoShow ;
}
private bool UndoCheckinEnabled ( )
{
if ( calendarGrid1 . SelectedAppointment < 1 ) return false ;
CGAppointment appt = ( CGAppointment ) this . Appointments . AppointmentTable [ calendarGrid1 . SelectedAppointment ] ;
return appt . CheckInTime . Ticks > 0 ;
}
2009-11-30 03:53:28 -05:00
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose ( bool disposing )
{
if ( disposing )
{
if ( components ! = null )
{
components . Dispose ( ) ;
}
}
base . Dispose ( disposing ) ;
}
2011-03-20 03:22:11 -04:00
void UpdateStatusBar ( DateTime dStart , DateTime dEnd , CGAvailability av )
2009-11-30 03:53:28 -05:00
{
2011-03-20 03:22:11 -04:00
System . Text . StringBuilder sbMsg = new System . Text . StringBuilder ( 100 ) ;
sbMsg . Append ( dStart . ToShortTimeString ( ) + " to " + dEnd . ToShortTimeString ( ) ) ;
if ( av ! = null & & m_nSlots > 0 )
2009-11-30 03:53:28 -05:00
{
2011-03-20 03:22:11 -04:00
sbMsg . Append ( String . Format ( " has {0} slot(s) available for {1}. " , m_nSlots . ToString ( ) , av . AccessTypeName ) ) ;
}
2009-11-30 03:53:28 -05:00
else
{
2011-03-20 03:22:11 -04:00
sbMsg . Append ( ": No appointment slots available. " ) ;
2009-11-30 03:53:28 -05:00
}
2011-03-20 03:22:11 -04:00
if ( av ! = null )
{
sbMsg . Append ( String . Format ( "Source Block: {0} to {1} with {2} slot(s) of type {3}" ,
av . StartTime . ToShortTimeString ( ) ,
av . EndTime . ToShortTimeString ( ) ,
av . Slots . ToString ( ) ,
av . AccessTypeName ) ) ;
sbMsg . Append ( ". " ) ;
if ( av . Note . Trim ( ) . Length > 0 ) sbMsg . Append ( "Note: " + av . Note + "." ) ;
}
this . statusBar1 . Text = sbMsg . ToString ( ) ;
2009-11-30 03:53:28 -05:00
}
private void EditScheduleAvailability ( )
{
CGAVDocument doc = new CGAVDocument ( ) ;
try
{
//If resource already open, then navigate to its window
CGAVView v = this . DocManager . GetAVViewByResource ( m_alSelectedTreeResourceArray ) ;
if ( v ! = null )
{
v . Activate ( ) ;
}
else
{
//If not already open, get a lock and open it
doc . DocManager = this . DocManager ;
for ( int j = 0 ; j < m_alSelectedTreeResourceArray . Count ; j + + )
{
doc . AddResource ( ( string ) m_alSelectedTreeResourceArray [ j ] ) ;
}
doc . DocName = this . m_sDocName ;
//Get preferred time scale from resource info
DataTable dt = this . DocManager . GlobalDataSet . Tables [ "Resources" ] ;
DataView dv = new DataView ( dt , "" , "RESOURCE_NAME ASC" , DataViewRowState . OriginalRows ) ;
int nScale = 60 ;
int nTest = 0 ;
string sResource ;
int nDataRow ;
DataRowView drv ;
string sResourceID = "" ;
for ( int j = 0 ; j < m_alSelectedTreeResourceArray . Count ; j + + )
{
sResource = ( string ) m_alSelectedTreeResourceArray [ j ] ;
nDataRow = dv . Find ( sResource ) ;
Debug . Assert ( nDataRow ! = - 1 ) ;
drv = dv [ nDataRow ] ;
if ( drv [ "TIMESCALE" ] . ToString ( ) = = "" )
{
nTest = 15 ; //15 minute default
}
else
{
nTest = ( int ) drv [ "TIMESCALE" ] ;
}
nScale = ( nTest < nScale ) ? nTest : nScale ;
sResourceID = drv [ "RESOURCEID" ] . ToString ( ) ;
}
doc . ResourceID = Convert . ToInt32 ( sResourceID ) ;
bool bLock = DocManager . ConnectInfo . bmxNetLib . Lock ( "^BSDXRES(" + sResourceID + ")" , "+" ) ;
if ( bLock = = false )
{
throw new BMXNetException ( "Another user is currently editing availability for this resource. Try later." ) ;
}
doc . OnOpenDocument ( ) ;
v = this . DocManager . GetAVViewByResource ( m_alSelectedTreeResourceArray ) ;
CalendarGrid cg = v . CGrid ;
cg . TimeScale = nScale ;
//Position grid to 0700
2011-01-17 09:25:48 -05:00
cg . PositionGrid ( 7 ) ;
2009-11-30 03:53:28 -05:00
}
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Unable to edit availability for " + m_sDocName + " schedule. " + ex . Message , "Clinical Scheduling" ) ;
2009-11-30 03:53:28 -05:00
this . m_DocManager . CloseAllViews ( doc ) ;
return ;
}
}
2011-01-18 09:15:22 -05:00
/// <summary>
/// Opens a view of the Schedule a user requested to open at a specific date
/// </summary>
/// <param name="sSelectedTreeResourceArray">A set of resources to open (?pending more investigation)</param>
/// <param name="dDate">Date at which to show the Grid</param>
2009-11-30 03:53:28 -05:00
private void OpenSelectedSchedule ( ArrayList sSelectedTreeResourceArray , DateTime dDate )
{
//If resource already open, then navigate to its window
2011-03-30 04:19:15 -04:00
CGView v = this . DocManager . GetViewByResource ( sSelectedTreeResourceArray ) ;
2009-11-30 03:53:28 -05:00
if ( v ! = null )
{
v . Activate ( ) ;
v . dateTimePicker1 . Value = dDate ;
2011-03-20 03:22:11 -04:00
v . RequestRefreshGrid ( ) ;
2011-01-18 09:15:22 -05:00
return ;
}
2011-01-20 09:32:28 -05:00
//So if it is not a view that's already open, it means we have to grab the data for
//So we tell the user to wait wait wait
this . Cursor = Cursors . WaitCursor ;
this . LoadSplash ( ) ; //Open "Loading" splash
//If this Document has no resources then use it (happens when the GUI has nothing open, typically after log-in)
2011-01-18 09:15:22 -05:00
//Else, create a new document
CGDocument doc ;
if ( this . Document . m_sResourcesArray . Count = = 0 )
{
doc = this . Document ;
2009-11-30 03:53:28 -05:00
}
else
{
2011-01-18 09:15:22 -05:00
doc = new CGDocument ( ) ;
doc . DocManager = this . DocManager ;
}
2011-01-16 05:41:21 -05:00
2011-01-18 09:15:22 -05:00
//Add resources to Document
for ( int j = 0 ; j < sSelectedTreeResourceArray . Count ; j + + )
{
doc . AddResource ( ( string ) sSelectedTreeResourceArray [ j ] ) ;
}
doc . DocName = this . m_sDocName ;
2011-01-16 05:41:21 -05:00
2011-01-18 09:15:22 -05:00
try
{
2011-03-30 04:19:15 -04:00
doc . OnOpenDocument ( dDate ) ; //this typically creates a new view
2011-01-18 09:15:22 -05:00
}
2011-01-16 05:41:21 -05:00
2011-01-18 09:15:22 -05:00
catch ( Exception ex )
{
MessageBox . Show ( "Unable to open " + m_sDocName + " schedule. " + ex . Message , "Clinical Scheduling" ) ;
this . m_DocManager . CloseAllViews ( doc ) ;
return ;
}
2011-03-30 04:19:15 -04:00
//We are doing this--again--to fetch the view we just opened in OnOpenDocument
//XXX: Yes, I know, this totally sucks. But I don't fully grasp the whole thing yet to refactor it.
2011-01-18 09:15:22 -05:00
v = this . DocManager . GetViewByResource ( sSelectedTreeResourceArray ) ;
2011-01-19 09:02:59 -05:00
2011-01-20 09:32:28 -05:00
//Position the Grid to start at a certain day.
2011-01-19 09:02:59 -05:00
//XXX: This must be a better way to do this.
v . dateTimePicker1 . Value = dDate ;
v . StartDate = doc . StartDate ;
2011-01-18 09:15:22 -05:00
//Get preferred time scale from resource info
//If more than one resource, get smallest time scale
CalendarGrid cg = v . CGrid ;
DataTable dt = this . DocManager . GlobalDataSet . Tables [ "Resources" ] ;
DataView dv = new DataView ( dt , "" , "RESOURCE_NAME ASC" , DataViewRowState . OriginalRows ) ;
int nScale = 60 ;
int nTest = 0 ;
string sResource ;
int nDataRow ;
DataRowView drv ;
for ( int j = 0 ; j < sSelectedTreeResourceArray . Count ; j + + )
{
sResource = ( string ) sSelectedTreeResourceArray [ j ] ;
nDataRow = dv . Find ( sResource ) ;
Debug . Assert ( nDataRow ! = - 1 ) ;
drv = dv [ nDataRow ] ;
if ( drv [ "TIMESCALE" ] . ToString ( ) = = "" )
2009-11-30 03:53:28 -05:00
{
2011-01-18 09:15:22 -05:00
nTest = 15 ; //15 minute default
2009-11-30 03:53:28 -05:00
}
2011-01-18 09:15:22 -05:00
else
2009-11-30 03:53:28 -05:00
{
2011-01-18 09:15:22 -05:00
nTest = ( int ) drv [ "TIMESCALE" ] ;
2009-11-30 03:53:28 -05:00
}
2011-01-18 09:15:22 -05:00
nScale = ( nTest < nScale ) ? nTest : nScale ;
}
2009-11-30 03:53:28 -05:00
2011-01-18 09:15:22 -05:00
cg . TimeScale = nScale ;
2009-11-30 03:53:28 -05:00
2011-01-18 09:15:22 -05:00
cg . PositionGrid ( 7 ) ;
2009-11-30 03:53:28 -05:00
2011-03-30 04:19:15 -04:00
//new code for v 1.5 //smh
//Disable entries that would make time scale smaller b/c users should not be able to
//make appointments for smaller time scales
if ( nScale > = 10 )
{
v . mnu10Minute . Enabled = true ;
v . mnu15Minute . Enabled = true ;
v . mnu20Minute . Enabled = true ;
v . mnu30Minute . Enabled = true ;
}
if ( nScale > = 15 )
{
v . mnu10Minute . Enabled = false ;
v . mnu15Minute . Enabled = true ;
v . mnu20Minute . Enabled = true ;
v . mnu30Minute . Enabled = true ;
}
if ( nScale > = 20 )
{
v . mnu10Minute . Enabled = false ;
v . mnu15Minute . Enabled = false ;
v . mnu20Minute . Enabled = true ;
v . mnu30Minute . Enabled = true ;
}
if ( nScale > = 30 )
{
v . mnu10Minute . Enabled = false ;
v . mnu15Minute . Enabled = false ;
v . mnu20Minute . Enabled = false ;
v . mnu30Minute . Enabled = true ;
}
if ( nScale > = 60 )
{
v . mnu10Minute . Enabled = false ;
v . mnu15Minute . Enabled = false ;
v . mnu20Minute . Enabled = false ;
v . mnu30Minute . Enabled = false ;
}
//end new code
2011-01-18 09:15:22 -05:00
//Get the OverBook and ModifySchedule permissions from ResourceUser table
//and populate the hashtables
string sOverbook ;
string sModSchedule ;
string sModAppts ;
bool bOverbook ;
bool bModSchedule ;
bool bModAppts ;
v . m_htOverbook = new Hashtable ( sSelectedTreeResourceArray . Count ) ;
v . m_htModifySchedule = new Hashtable ( sSelectedTreeResourceArray . Count ) ;
v . m_htChangeAppts = new Hashtable ( sSelectedTreeResourceArray . Count ) ;
dt = this . DocManager . GlobalDataSet . Tables [ "ResourceUser" ] ;
dv = new DataView ( dt , "" , "RESOURCENAME ASC" , DataViewRowState . OriginalRows ) ;
2011-09-04 02:28:56 -04:00
//dv.RowFilter = "USERNAME = '" + filte_name + "'";
dv . RowFilter = String . Format ( "USERNAME = '{0}'" , this . DocManager . ConnectInfo . UserName . Replace ( "'" , "''" ) ) ;
2011-01-18 09:15:22 -05:00
for ( int j = 0 ; j < dv . Count ; j + + )
{
drv = dv [ j ] ;
sResource = drv [ "RESOURCENAME" ] . ToString ( ) ;
sOverbook = drv [ "OVERBOOK" ] . ToString ( ) ;
bOverbook = ( sOverbook = = "YES" ) ? true : false ;
sModSchedule = drv [ "MODIFY_SCHEDULE" ] . ToString ( ) ;
bModSchedule = ( sModSchedule = = "YES" ) ? true : false ;
sModAppts = drv [ "MODIFY_APPOINTMENTS" ] . ToString ( ) ;
bModAppts = ( sModAppts = = "YES" ) ? true : false ;
v . m_htOverbook [ sResource ] = bOverbook ;
v . m_htModifySchedule [ sResource ] = bModSchedule ;
v . m_htChangeAppts [ sResource ] = bModAppts ;
}
2009-11-30 03:53:28 -05:00
2011-01-18 09:15:22 -05:00
//For programmers and scheduling managers, set all permissions for all resources
if ( this . DocManager . ScheduleManager = = true )
{
dt = this . DocManager . GlobalDataSet . Tables [ "Resources" ] ;
foreach ( DataRow dr in dt . Rows )
2009-11-30 03:53:28 -05:00
{
2011-01-18 09:15:22 -05:00
sResource = dr [ "RESOURCE_NAME" ] . ToString ( ) ;
v . m_htOverbook [ sResource ] = true ;
v . m_htModifySchedule [ sResource ] = true ;
v . m_htChangeAppts [ sResource ] = true ;
2009-11-30 03:53:28 -05:00
}
}
2011-01-18 09:15:22 -05:00
v . calendarGrid1 . SetOverlapTable ( ) ;
v . calendarGrid1 . Refresh ( ) ;
2011-01-20 09:32:28 -05:00
// Set cursor back and stop splash screen
this . Cursor = Cursors . Default ;
StopSplash ( ) ;
2009-11-30 03:53:28 -05:00
}
private void LoadTree ( )
{
//Navigate from ResourceGroup table to Resources table
DataRow [ ] arrRows ;
DataRelation dr = DocManager . GlobalDataSet . Relations [ "GroupResource" ] ;
string sGroup ;
string sResource ;
int nIndex = 0 ;
foreach ( DataRow r in DocManager . GlobalDataSet . Tables [ "ResourceGroup" ] . Rows )
{
sGroup = r [ "RESOURCE_GROUP" ] . ToString ( ) ;
TreeNode deptNode = new TreeNode ( sGroup ) ;
nIndex = this . tvSchedules . Nodes . Add ( deptNode ) ;
tvSchedules . Nodes [ nIndex ] . Tag = "Dept" ;
arrRows = r . GetChildRows ( dr ) ;
for ( int i = 0 ; i < arrRows . Length ; i + + )
{
sResource = arrRows [ i ] [ "RESOURCE_NAME" ] . ToString ( ) ;
TreeNode resNode = new TreeNode ( sResource ) ;
int nResIndex = deptNode . Nodes . Add ( resNode ) ;
deptNode . Nodes [ nResIndex ] . Tag = "Resource" ;
}
}
}
public void CreateNewSchedule ( )
{
//Create a new document and open it
CGDocument doc = new CGDocument ( ) ;
doc . DocManager = this . DocManager ;
try
{
2011-03-20 03:22:11 -04:00
doc . OnOpenDocument ( DateTime . Today ) ;
2009-11-30 03:53:28 -05:00
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Unable to open " + m_sDocName + " schedule. " + ex . Message , "Clinical Scheduling" ) ;
2009-11-30 03:53:28 -05:00
this . m_DocManager . CloseAllViews ( doc ) ;
return ;
}
}
private void AppointmentEdit ( )
{
try
{
int nApptID = this . calendarGrid1 . SelectedAppointment ;
Debug . Assert ( nApptID ! = 0 ) ;
CGAppointment a = ( CGAppointment ) this . Appointments . AppointmentTable [ nApptID ] ;
DAppointPage dAppt = new DAppointPage ( ) ;
dAppt . DocManager = this . m_DocManager ;
dAppt . InitializePage ( a ) ;
calendarGrid1 . CGToolTip . Active = false ;
if ( dAppt . ShowDialog ( this ) = = DialogResult . Cancel )
{
calendarGrid1 . CGToolTip . Active = true ;
return ;
}
calendarGrid1 . CGToolTip . Active = true ;
string sNote = dAppt . Note ;
//Call Document to edit appointment
this . Document . EditAppointment ( a , sNote ) ;
2011-04-14 08:33:14 -04:00
if ( dAppt . PrintAppointmentSlip )
{
PrintAppointmentSlip ( a ) ;
}
//Redraw appointments
this . UpdateArrays ( ) ;
//Then tell RPMS that we are updated
RaiseRPMSEvent ( "BSDX SCHEDULE" , a . Resource ) ;
2009-11-30 03:53:28 -05:00
}
catch ( Exception ex )
{
Debug . Write ( "CGView.AppointmentEdit Failed: " + ex . Message ) ;
}
}
/// <summary>
2011-03-29 05:46:30 -04:00
/// Marks all selected appointments as No Show from this.calendarGrid1.SelectedAppointments
2009-11-30 03:53:28 -05:00
/// </summary>
2011-03-29 05:46:30 -04:00
/// <param name="bNoShow">True - Mark as noshow; False - undo noshow</param>
2009-11-30 03:53:28 -05:00
private void AppointmentNoShow ( bool bNoShow )
{
//bNoShow indicates whether to mark or un-mark as noshow
bool bMarked = false ; //Indicates at least one attempt to mark as noshow succeeded
bool bRebook = false ; //Stores user's response to auto-rebook dialog question
2011-03-29 05:46:30 -04:00
CGAppointments alRebookList = new CGAppointments ( ) ; // list of appointments to rebook
DNoShow dlg = new DNoShow ( ) ; // no show dialog
if ( bNoShow = = true ) // if noshowing, show the dialog to ask the user
2009-11-30 03:53:28 -05:00
{
if ( dlg . ShowDialog ( this ) = = DialogResult . Cancel )
{
return ;
}
}
bRebook = dlg . AutoRebook ;
foreach ( CGAppointment a in this . calendarGrid1 . SelectedAppointments . AppointmentTable . Values )
{
int nApptID = a . AppointmentKey ;
Debug . Assert ( nApptID ! = 0 ) ;
try
{
2011-03-29 05:46:30 -04:00
if ( ( bNoShow = = true ) // if no-showing
2009-11-30 03:53:28 -05:00
& &
( a . StartTime . Date > DateTime . Today . Date )
& &
2009-11-30 23:54:57 -05:00
( MessageBox . Show ( this , "The appointment for " + a . PatientName + " is in the future. Are you sure you want to No-Show?" , "Windows Scheduling" , MessageBoxButtons . OKCancel , MessageBoxIcon . Question ) ! = DialogResult . OK ) )
2009-11-30 03:53:28 -05:00
{
}
2011-03-29 05:46:30 -04:00
else // otherwise, make or undo show
2009-11-30 03:53:28 -05:00
{
2011-03-29 05:46:30 -04:00
string sError = Document . AppointmentNoShow ( a , bNoShow ) ;
2009-11-30 03:53:28 -05:00
if ( sError ! = "1" )
throw new Exception ( sError ) ;
bMarked = true ;
}
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Unable to mark appointment No Show: " + ex . Message , "Clinical Scheduling" ) ;
2009-11-30 03:53:28 -05:00
}
2011-03-29 05:46:30 -04:00
2009-11-30 03:53:28 -05:00
if ( bRebook = = true )
{
try
{
CGAppointment aRebook ;
int nMinimumdays = dlg . RebookStartDays ;
int nMaximumdays = dlg . RebookMaxDays ;
int nAccessType = dlg . RebookAccessType ;
//-1 means use current type
if ( nAccessType = = - 1 )
{
//Get access type from grid
int nRow = 0 ;
int nCol = 0 ;
CGCell cgCell = new CGCell ( ) ;
this . calendarGrid1 . GetCellFromTime ( a . StartTime , ref nRow , ref nCol , true , a . Resource ) ;
cgCell . CellColumn = nCol ;
cgCell . CellRow = nRow ;
this . calendarGrid1 . GetTypeFromCell ( cgCell , out nAccessType ) ;
a . AccessTypeID = nAccessType ;
}
string sResult = Document . AutoRebook ( a , nAccessType , nMinimumdays , nMaximumdays , out aRebook ) ;
if ( sResult = = "1" )
{
//Add appointment to list of rebooked appointments
alRebookList . AddAppointment ( a ) ;
}
else
{
MessageBox . Show ( "Unable to rebook this patient: " + a . PatientName ) ;
}
}
catch ( Exception ex )
{
MessageBox . Show ( "Unable to rebook: " + ex . Message ) ;
}
}
2011-03-29 05:46:30 -04:00
if ( bMarked = = true )
{
//Notify other scheduling users that this schedule has changed
try
{
//this.Document.RefreshDocument(); no need for this; event raised back and prompts refresh itself.
RaiseRPMSEvent ( "BSDX SCHEDULE" , a . Resource ) ;
}
catch ( Exception ex )
{
Debug . Write ( ex . Message ) ;
}
this . calendarGrid1 . Invalidate ( ) ;
}
}
AutoRebookFromList ( alRebookList ) ;
2009-11-30 03:53:28 -05:00
}
2011-03-29 05:46:30 -04:00
/// <summary>
/// Prints Auto Rebook Letters; does nothing else to DB!!!
/// </summary>
/// <param name="alRebookList">List of appointments</param>
2009-11-30 03:53:28 -05:00
private void AutoRebookFromList ( CGAppointments alRebookList )
{
//Print AutoRebook letters.
if ( alRebookList . AppointmentCount > 0 )
{
//build |-delimited list of ApptIDs to pass to BSDX REBOOK LIST
string sApptIDList = "" ;
System . Collections . ArrayList a = new ArrayList ( ) ;
foreach ( CGAppointment appt in alRebookList . AppointmentTable . Values )
{
string sApptID = appt . AppointmentKey . ToString ( ) + "|" ;
sApptIDList + = sApptID ;
if ( a . Contains ( appt . Resource ) = = false )
a . Add ( appt . Resource ) ;
}
2010-06-06 20:59:53 -04:00
// Print rebooks
2009-11-30 03:53:28 -05:00
string sClinicList = "" ;
foreach ( string sRes in a )
{
sClinicList = sClinicList + sRes + "|" ;
}
2010-06-04 22:19:48 -04:00
DPatientLetter dpl = new DPatientLetter ( ) ;
dpl . InitializeFormRebookLetters ( this . DocManager , sClinicList , sApptIDList ) ;
2009-11-30 03:53:28 -05:00
dpl . ShowDialog ( this ) ;
}
}
2011-05-08 05:17:53 -04:00
/// <summary>
/// Delete one Radiology Appointment
/// </summary>
private void AppointmentDeleteOneRadiology ( )
{
Debug . Assert ( this . calendarGrid1 . SelectedAppointment > 0 ) ;
CGAppointment a = this . Appointments . AppointmentTable [ this . calendarGrid1 . SelectedAppointment ] as CGAppointment ;
Debug . Assert ( a . RadiologyExamIEN . HasValue ) ;
2011-05-16 07:31:39 -04:00
//Can we cancel the appointment?
bool _canCancel = CGDocumentManager . Current . DAL . CanCancelRadExam ( a . RadiologyExamIEN . Value ) ;
if ( ! _canCancel )
{
2011-05-16 09:47:52 -04:00
MessageBox . Show ( this , "This appointment cannot be cancelled.\nReason:\nThe exam associated with this appointment is active/complete/discontinued." ) ;
2011-05-16 07:31:39 -04:00
return ;
}
//Prior to making expensive db calls, tell the grid nothing is selected anymore so nobody would try to pick it up later
2011-05-08 05:17:53 -04:00
this . calendarGrid1 . SelectedAppointment = 0 ;
//Now, Cancel the appointment
this . Document . DeleteAppointment ( a . AppointmentKey ) ;
2011-05-11 07:41:51 -04:00
//Cancel Radiology Exam
CGDocumentManager . Current . DAL . CancelRadiologyExam ( a . PatientID , a . RadiologyExamIEN . Value ) ;
2011-05-08 05:17:53 -04:00
//redraw the grid to display new set of appointments after this appt was removed.
this . UpdateArrays ( ) ;
2011-05-11 07:41:51 -04:00
2011-05-16 07:31:39 -04:00
//Tell other instances that this schedule has been updated
2011-05-11 07:41:51 -04:00
RaiseRPMSEvent ( "BSDX SCHEDULE" , a . Resource ) ;
2011-05-08 05:17:53 -04:00
}
2009-11-30 03:53:28 -05:00
/// <summary>
/// Delete appointment ApptID
/// </summary>
/// <param name="nApptID"></param>
/// <returns></returns>
private string AppointmentDeleteOne ( int nApptID )
{
return Document . DeleteAppointment ( nApptID ) ;
}
/// <summary>
/// Delete all selected appointments
/// </summary>
2011-03-29 05:46:30 -04:00
private void AppointmentDelete ( )
{
calendarGrid1 . CGToolTip . Active = false ;
CGAppointments alRebookList = new CGAppointments ( ) ;
2009-11-30 03:53:28 -05:00
2011-03-29 05:46:30 -04:00
// check to see if any appointment is checked in first
foreach ( CGAppointment a in this . calendarGrid1 . SelectedAppointments . AppointmentTable . Values )
{
if ( a . CheckInTime . Ticks > 0 )
{
2011-05-03 04:01:50 -04:00
MessageBox . Show ( "You must undo the check-in first before removing the appointment." ) ;
2011-03-29 05:46:30 -04:00
return ;
}
}
2009-11-30 03:53:28 -05:00
2011-03-29 05:46:30 -04:00
DCancelAppt dCancel = new DCancelAppt ( ) ;
dCancel . InitializePage ( this . m_DocManager ) ;
if ( dCancel . ShowDialog ( this ) ! = DialogResult . OK )
{
calendarGrid1 . CGToolTip . Active = true ;
return ;
}
2009-11-30 03:53:28 -05:00
2011-05-08 05:17:53 -04:00
//At this point, the appointment will be deleted...
//Remove the Selected Appointment from the grid because we don't anybody to think there's still
//an appointment selected while we are still updating the grid
this . calendarGrid1 . SelectedAppointment = 0 ;
2011-03-29 05:46:30 -04:00
bool bClinic = dCancel . ClinicCancelled ;
int nReason = dCancel . CancelReason ;
string sRemarks = dCancel . CancelRemarks ;
bool bRebook = dCancel . AutoRebook ;
int nRebookStart = dCancel . RebookStartDays ;
int nRebookMax = dCancel . RebookMaxDays ;
int nRebookAccessType = dCancel . RebookAccessType ;
2009-11-30 03:53:28 -05:00
2011-03-29 05:46:30 -04:00
calendarGrid1 . CGToolTip . Active = true ;
2009-11-30 03:53:28 -05:00
2011-03-29 05:46:30 -04:00
foreach ( CGAppointment a in this . calendarGrid1 . SelectedAppointments . AppointmentTable . Values )
{
int nApptID = a . AppointmentKey ;
Debug . Assert ( nApptID ! = 0 ) ;
try
{
string sError = Document . DeleteAppointment ( nApptID , bClinic , nReason , sRemarks ) ;
if ( sError ! = "" )
throw new Exception ( sError ) ;
2009-11-30 03:53:28 -05:00
2011-03-29 05:46:30 -04:00
this . UpdateArrays ( ) ; //Redraw this calendar grid
2009-11-30 03:53:28 -05:00
2011-03-29 05:46:30 -04:00
if ( bRebook = = true )
{
try
{
//TODO: Parameterize or dialogize the minum and maximum rebook days
CGAppointment aRebook ;
int nMinimumdays = nRebookStart ;
int nMaximumdays = nRebookMax ;
string sResult = Document . AutoRebook ( a , nRebookAccessType , nMinimumdays , nMaximumdays , out aRebook ) ;
if ( sResult = = "1" )
{
//Add appointment to list of rebooked appointments
alRebookList . AddAppointment ( a ) ;
}
2011-01-27 02:46:45 -05:00
2011-03-29 05:46:30 -04:00
}
catch ( Exception ex )
{
MessageBox . Show ( "Unable to rebook: " + ex . Message ) ;
}
}
2009-11-30 03:53:28 -05:00
2011-03-29 05:46:30 -04:00
RaiseRPMSEvent ( "BSDX SCHEDULE" , a . Resource ) ;
}
catch ( Exception ex )
{
MessageBox . Show ( "Unable to delete appointment. " + ex . Message , "Clinical Scheduling" ) ;
}
if ( alRebookList . AppointmentCount > 0 )
{
AutoRebookFromList ( alRebookList ) ;
}
}
}
2009-11-30 03:53:28 -05:00
private void AppointmentCheckIn ( )
{
int nApptID = this . calendarGrid1 . SelectedAppointment ;
Debug . Assert ( nApptID ! = 0 ) ;
2011-01-26 06:01:39 -05:00
//smh
//CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[nApptID];
CGAppointment a = ( CGAppointment ) this . Document . Appointments . AppointmentTable [ nApptID ] ;
2009-11-30 03:53:28 -05:00
try
{
bool bAlreadyCheckedIn = false ;
if ( a . CheckInTime . Ticks > 0 )
bAlreadyCheckedIn = true ;
if ( ( bAlreadyCheckedIn = = false )
& &
( a . StartTime . Date > DateTime . Today . Date ) )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( this , "It is too early to check in " + a . PatientName , "Windows Scheduling" , MessageBoxButtons . OK , MessageBoxIcon . Exclamation ) ;
2009-11-30 03:53:28 -05:00
return ;
}
DCheckIn dlgCheckin = new DCheckIn ( ) ;
2011-03-23 05:15:51 -04:00
dlgCheckin . InitializePage ( a ) ;
2009-11-30 03:53:28 -05:00
calendarGrid1 . CGToolTip . Active = false ;
if ( dlgCheckin . ShowDialog ( this ) ! = DialogResult . OK )
{
calendarGrid1 . CGToolTip . Active = true ;
return ;
}
calendarGrid1 . CGToolTip . Active = true ;
2011-03-24 09:26:14 -04:00
if ( bAlreadyCheckedIn ! = true )
{
DateTime dtCheckIn = dlgCheckin . CheckInTime ;
2009-11-30 03:53:28 -05:00
2011-03-24 09:26:14 -04:00
//Tell appointment that it is checked in, for proper coloring;
//When you refresh from the DB, it will have this property.
a . CheckInTime = DateTime . Now ;
2009-11-30 03:53:28 -05:00
2011-03-24 09:26:14 -04:00
//Save to Database
this . Document . CheckInAppointment ( nApptID , dtCheckIn ) ;
}
2011-03-23 05:15:51 -04:00
//Get Provider (XXXXXXXX: NOT SAVED TO THE DATABASE RIGHT NOW)
a . Provider = dlgCheckin . Provider ;
2011-01-26 06:01:39 -05:00
2011-03-23 05:15:51 -04:00
// Print Routing Slip if user checks that box...
2011-01-09 07:13:00 -05:00
if ( dlgCheckin . PrintRouteSlip )
2011-03-23 05:15:51 -04:00
this . PrintRoutingSlip ( a ) ;
2010-06-19 12:41:06 -04:00
2011-03-03 04:44:18 -05:00
//redraw grid
2009-11-30 03:53:28 -05:00
this . calendarGrid1 . Invalidate ( ) ;
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Error checking in patient: " + ex . Message , "Clinical Scheduling" ) ;
2009-11-30 03:53:28 -05:00
}
}
2011-03-29 05:46:30 -04:00
private void AppointmentUndoCheckin ( )
{
Debug . Assert ( calendarGrid1 . SelectedAppointment > 0 ) ;
foreach ( CGAppointment a in this . calendarGrid1 . SelectedAppointments . AppointmentTable . Values )
{
2011-03-30 06:54:56 -04:00
2011-03-29 05:46:30 -04:00
string msg ; //out var
bool didweSucceed = Document . AppointmentUndoCheckin ( a , out msg ) ;
if ( ! didweSucceed )
{
MessageBox . Show ( "Error: " + msg ) ;
continue ;
}
RaiseRPMSEvent ( "BSDX SCHEDULE" , a . Resource ) ;
}
this . UpdateArrays ( ) ;
}
2009-11-30 03:53:28 -05:00
private void AppointmentAddWalkin ( )
{
try
{
2011-03-30 05:42:22 -04:00
2009-11-30 03:53:28 -05:00
//Get Time and Resource from Selected Cell
DateTime dStart = DateTime . Today ;
DateTime dEnd = DateTime . Today ;
string sResource = "" ;
bool bRet = this . calendarGrid1 . GetSelectedTime ( out dStart , out dEnd , out sResource ) ;
if ( bRet = = false )
return ;
TimeSpan tsDuration = dEnd - dStart ;
int nDuration = ( int ) tsDuration . TotalMinutes ;
Debug . Assert ( nDuration > 0 ) ;
/ *
* 8 - 10 - 05 Added check to prevent walkin from being created
* on a date later than today .
* /
if ( dStart . Date > DateTime . Today . Date )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( this , "You cannot create a walk-in appointment for a date in the future.\n Select today's date and try again." , "Windows Scheduling" , MessageBoxButtons . OK , MessageBoxIcon . Exclamation ) ;
2009-11-30 03:53:28 -05:00
return ;
}
2010-09-28 09:40:17 -04:00
// Added check for making Walk-ins in the past. 9/28/2010
if ( dStart . Date < DateTime . Today . Date )
{
var result = MessageBox . Show ( "Are you sure you want to make a Walk-in in the past?" , "Windows Scheduling" , MessageBoxButtons . YesNo , MessageBoxIcon . Exclamation , MessageBoxDefaultButton . Button2 ) ;
if ( result = = DialogResult . No ) return ;
}
2009-11-30 03:53:28 -05:00
/ *
* 8 - 10 - 05 Added overbook prompt for walkin
* /
2011-01-26 06:01:39 -05:00
//SMH: Takes too long to do.
//this.Document.RefreshDocument();
2011-03-20 03:22:11 -04:00
CGAvailability resultantAvail ;
m_nSlots = m_Document . SlotsAvailable ( dStart , dEnd , sResource , this . calendarGrid1 . TimeScale , out resultantAvail ) ;
2009-11-30 03:53:28 -05:00
if ( m_nSlots < 1 )
{
2009-11-30 23:54:57 -05:00
DialogResult dr = MessageBox . Show ( this , "There are no slots available at the selected time. Do you want to overbook this appointment?" , "Clinical Scheduling" , MessageBoxButtons . YesNo ) ;
2009-11-30 03:53:28 -05:00
if ( dr ! = DialogResult . Yes )
{
return ;
}
}
//Display a dialog to collect Patient Name
DPatientLookup dPat = new DPatientLookup ( ) ;
dPat . DocManager = m_DocManager ;
int nAccessTypeID = 0 ;
bRet = calendarGrid1 . GetSelectedType ( out nAccessTypeID ) ;
if ( dPat . ShowDialog ( this ) = = DialogResult . Cancel )
{
return ;
}
2011-03-30 05:42:22 -04:00
CGAppointment appt = new CGAppointment ( ) ;
2009-11-30 03:53:28 -05:00
appt . PatientID = Convert . ToInt32 ( dPat . PatientIEN ) ;
appt . PatientName = dPat . PatientName ;
appt . StartTime = dStart ;
appt . EndTime = dEnd ;
appt . Resource = sResource ;
appt . HealthRecordNumber = dPat . HealthRecordNumber ;
2011-03-30 05:42:22 -04:00
appt . Patient = new Patient
{
DFN = Convert . ToInt32 ( dPat . PatientIEN ) ,
ID = dPat . PatientPID ,
Name = dPat . PatientName ,
HRN = dPat . HealthRecordNumber ,
DOB = dPat . PatientDOB
} ;
2011-01-26 06:01:39 -05:00
//smh: Takes too long
//this.Document.RefreshDocument();
2009-11-30 03:53:28 -05:00
//Call Document to add a walkin appointment
int nApptID = this . Document . CreateAppointment ( appt , true ) ;
//Now check them in.
calendarGrid1 . SelectedAppointment = nApptID ;
AppointmentCheckIn ( ) ;
2011-03-30 05:42:22 -04:00
//Show the new set of appointments by calling UpdateArrays.
2011-01-26 06:01:39 -05:00
this . UpdateArrays ( ) ;
2011-03-29 05:46:30 -04:00
RaiseRPMSEvent ( "BSDX SCHEDULE" , appt . Resource ) ;
2009-11-30 03:53:28 -05:00
}
catch ( Exception ex )
{
2011-01-26 06:01:39 -05:00
string msg ;
if ( BMXNetLib . Piece ( ex . Message , "~" , 1 ) = = "-10" ) // -10 means that BSDXAPI reported an error.
msg = BMXNetLib . Piece ( ex . Message , "~" , 4 ) ;
else
msg = ex . Message ;
2009-11-30 03:53:28 -05:00
2011-01-26 06:01:39 -05:00
MessageBox . Show ( "VISTA says: \r\n" + msg , "Unable to Make Walk-in Appointment" ) ;
return ;
2009-11-30 03:53:28 -05:00
}
}
private void AppointmentAddNew ( )
{
try
{
//Get Time and Resource from Selected Cell
DateTime dStart = DateTime . Today ;
DateTime dEnd = DateTime . Today ;
string sResource = "" ;
bool bRet = this . calendarGrid1 . GetSelectedTime ( out dStart , out dEnd , out sResource ) ;
if ( bRet = = false )
return ;
2010-09-28 09:40:17 -04:00
// Added check for making Walk-ins in the past. 9/28/2010
if ( dStart . Date < DateTime . Today . Date )
{
var result = MessageBox . Show ( "Are you sure you want to make an appointment in the past?" , "Windows Scheduling" , MessageBoxButtons . YesNo , MessageBoxIcon . Exclamation , MessageBoxDefaultButton . Button2 ) ;
if ( result = = DialogResult . No ) return ;
}
2009-11-30 03:53:28 -05:00
//Test dStart for Holiday
DataView dvHoliday = new DataView ( this . DocManager . GlobalDataSet . Tables [ "HOLIDAY" ] ) ;
dvHoliday . Sort = "DATE ASC" ;
int nFind = dvHoliday . Find ( dStart . Date ) ;
if ( nFind > - 1 )
{
string sHoliday = "" ;
DataRowView drv = dvHoliday [ nFind ] ;
sHoliday = drv [ "NAME" ] . ToString ( ) ;
2009-11-30 23:54:57 -05:00
if ( MessageBox . Show ( this , dStart . ToShortDateString ( ) + " is a holiday (" + sHoliday + "). Are you sure you want to make this appointment?" , "Clinical Scheduling" , MessageBoxButtons . OKCancel , MessageBoxIcon . Question ) ! = DialogResult . OK )
2009-11-30 03:53:28 -05:00
return ;
}
2011-01-26 06:01:39 -05:00
//Sam: takes too long. Remove this call; deal with the issue of concurrent appointments another way.
//this.Document.RefreshDocument();
2011-03-20 03:22:11 -04:00
CGAvailability resultantAvail ;
m_nSlots = m_Document . SlotsAvailable ( dStart , dEnd , sResource , this . calendarGrid1 . TimeScale , out resultantAvail ) ;
2009-11-30 03:53:28 -05:00
if ( m_nSlots < 1 )
{
2009-11-30 23:54:57 -05:00
DialogResult dr = MessageBox . Show ( this , "There are no slots available at the selected time. Do you want to overbook this appointment?" , "Clinical Scheduling" , MessageBoxButtons . YesNo ) ;
2009-11-30 03:53:28 -05:00
if ( dr ! = DialogResult . Yes )
{
return ;
}
}
//Display a dialog to collect Patient Name
DPatientLookup dPat = new DPatientLookup ( ) ;
dPat . DocManager = m_DocManager ;
int nAccessTypeID = 0 ;
bRet = calendarGrid1 . GetSelectedType ( out nAccessTypeID ) ;
if ( dPat . ShowDialog ( this ) = = DialogResult . Cancel )
{
return ;
}
//Call the appointment dialog to collect the appointment info
Debug . Assert ( dPat . PatientIEN ! = "" ) ;
DAppointPage dAppt = new DAppointPage ( ) ;
dAppt . DocManager = this . m_DocManager ;
string sNote = "" ;
2011-03-20 03:22:11 -04:00
dAppt . InitializePage ( dPat . PatientIEN , dStart , dEnd , sResource , sNote , nAccessTypeID ) ;
2009-11-30 03:53:28 -05:00
if ( dAppt . ShowDialog ( this ) = = DialogResult . Cancel )
{
return ;
}
2011-03-20 03:22:11 -04:00
CGAppointment appt = dAppt . Appointment ;
// old way of making an appointment
/ * new CGAppointment ( ) ;
2009-11-30 03:53:28 -05:00
appt . PatientID = Convert . ToInt32 ( dPat . PatientIEN ) ;
appt . PatientName = dPat . PatientName ;
appt . StartTime = dStart ;
appt . EndTime = dEnd ;
appt . Resource = sResource ;
appt . Note = dAppt . Note ;
appt . HealthRecordNumber = dPat . HealthRecordNumber ;
appt . AccessTypeID = nAccessTypeID ;
2011-03-20 03:22:11 -04:00
* /
2009-11-30 03:53:28 -05:00
2011-01-26 06:01:39 -05:00
//Call Document to add a new appointment. Document adds appointment to CGAppointments array.
2009-11-30 03:53:28 -05:00
this . Document . CreateAppointment ( appt ) ;
2010-06-10 17:20:08 -04:00
2011-03-23 05:15:51 -04:00
2011-03-20 03:22:11 -04:00
if ( dAppt . PrintAppointmentSlip )
{
2011-03-23 05:15:51 -04:00
PrintAppointmentSlip ( appt ) ;
2011-03-20 03:22:11 -04:00
}
2011-01-26 06:01:39 -05:00
//Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments
this . UpdateArrays ( ) ;
2011-03-29 05:46:30 -04:00
RaiseRPMSEvent ( "BSDX SCHEDULE" , appt . Resource ) ;
2009-11-30 03:53:28 -05:00
}
catch ( Exception ex )
2011-01-26 06:01:39 -05:00
{
string msg ;
if ( BMXNetLib . Piece ( ex . Message , "~" , 1 ) = = "-10" ) // -10 means that BSDXAPI reported an error.
msg = BMXNetLib . Piece ( ex . Message , "~" , 4 ) ;
else
msg = ex . Message ;
MessageBox . Show ( "VISTA says: \r\n" + msg , "Unable to Make Appointment" ) ;
2009-11-30 03:53:28 -05:00
return ;
}
}
2011-05-08 05:17:53 -04:00
/// <summary>
/// Add a new Radiology Appointment to VISTA (<28> <> <EFBFBD> <EFBFBD> as my mom calls it)
/// </summary>
private void AppointmentAddNewRadiology ( )
{
2011-05-11 07:41:51 -04:00
try
{
DateTime dStart , dEnd ; //return vales for below
string sResource ; //ditto
int nAccessTypeID = 0 ; //ditto
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
this . calendarGrid1 . GetSelectedTime ( out dStart , out dEnd , out sResource ) ;
this . calendarGrid1 . GetSelectedType ( out nAccessTypeID ) ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
Debug . Assert ( sResource ! = null ) ;
Debug . Assert ( dStart > DateTime . MinValue ) ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
//Get Slots
CGAvailability resultantAvail ;
m_nSlots = m_Document . SlotsAvailable ( dStart , dEnd , sResource , this . calendarGrid1 . TimeScale , out resultantAvail ) ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
if ( m_nSlots < 1 )
{
DialogResult dr = MessageBox . Show ( this , "There are no slots available at the selected time. Do you want to overbook this appointment?" , "Clinical Scheduling" , MessageBoxButtons . YesNo ) ;
if ( dr ! = DialogResult . Yes )
{
return ;
}
}
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
//Display a dialog to collect Patient Name
DPatientLookup dPat = new DPatientLookup ( ) ;
dPat . DocManager = m_DocManager ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
if ( dPat . ShowDialog ( this ) = = DialogResult . Cancel )
{
return ;
}
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
int DFN = Int32 . Parse ( dPat . PatientIEN ) ;
// Hospital Location IEN
int hlIEN = ( from resource in CGDocumentManager . Current . GlobalDataSet . Tables [ "Resources" ] . AsEnumerable ( )
where resource . Field < string > ( "RESOURCE_NAME" ) = = sResource
select resource . Field < int > ( "HOSPITAL_LOCATION_ID" ) ) . FirstOrDefault ( ) ;
//Get Radiology Exams from the DB
List < RadiologyExam > _radExams = CGDocumentManager . Current . DAL . GetRadiologyExamsForPatientinHL ( DFN , hlIEN ) ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
//If none found...
if ( ! _radExams . Any ( ) )
{
MessageBox . Show ( "Patient does not have any radiology exams to register." ) ;
return ;
}
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
//Display a form for the user to select radiology exams.
DRadExamsSelect _radform = new DRadExamsSelect ( _radExams ) ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
if ( _radform . ShowDialog ( ) = = DialogResult . Cancel ) return ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
//Get some return values
int _examien = _radform . ExamIEN ;
string _procedurename = _radform . ProcedureName ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
//Now create and save the appointment
CGAppointment appt = new CGAppointment ( ) ;
string _sNote = "Radiology Exam (" + _examien + "): " + _procedurename ;
appt . CreateAppointment ( dStart , dEnd , _sNote , 0 , sResource ) ;
appt . PatientID = Int32 . Parse ( dPat . PatientIEN ) ;
appt . PatientName = dPat . PatientName ;
appt . AccessTypeID = nAccessTypeID ;
appt . RadiologyExamIEN = _examien ;
appt . Patient = new Patient
{
DFN = Convert . ToInt32 ( dPat . PatientIEN ) ,
ID = dPat . PatientPID ,
Name = dPat . PatientName ,
HRN = dPat . HealthRecordNumber ,
DOB = dPat . PatientDOB
} ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
this . Document . CreateAppointment ( appt ) ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
//Save Radiology Exam Schedule Info to Radiology Package
CGDocumentManager . Current . DAL . ScheduleRadiologyExam ( DFN , _examien , dStart ) ;
2011-05-08 05:17:53 -04:00
2011-05-11 07:41:51 -04:00
//Print Appointment Slip if requested
if ( _radform . PrintAppointmentSlip ) this . PrintAppointmentSlip ( appt ) ;
//Now redraw the grid to display the new appointments
this . UpdateArrays ( ) ;
//Raise event to other clients
RaiseRPMSEvent ( "BSDX SCHEDULE" , appt . Resource ) ;
}
catch ( Exception ex )
{
string msg ;
if ( BMXNetLib . Piece ( ex . Message , "~" , 1 ) = = "-10" ) // -10 means that BSDXAPI reported an error.
msg = BMXNetLib . Piece ( ex . Message , "~" , 4 ) ;
else
msg = ex . Message ;
MessageBox . Show ( "VISTA says: \r\n" + msg , "Unable to Make Appointment" ) ;
return ;
}
2011-05-08 05:17:53 -04:00
}
2011-01-20 09:32:28 -05:00
#region BMX Event Processing and Callbacks
/// <summary>
/// Loosely typed delegate used several times below.
/// </summary>
delegate void OnUpdateScheduleDelegate ( ) ;
/// <summary>
/// Subscription point for each CGView to process BMX events polled from the server
/// </summary>
/// <param name="obj">Not used</param>
/// <param name="e">BMXEvent Args:
/// e.BMXEvent is free text for Event Type; e.BMXParam is free text for Event Arguments</param>
private void BMXNetEventHandler ( Object obj , BMXNet . BMXNetEventArgs e )
{
try
{
// if this class is undefined (e.g. if the user just closed the form, do nothing
if ( this = = null ) return ;
// if event is Autofire event
if ( e . BMXEvent = = "BMXNet AutoFire" )
{
Debug . Write ( "CGView caught AutoFire event.\n" ) ;
//Create a delegate to OnUpdateSchedule and call Async
//Once Async Call is done, go to OnUpdateScheduleCallback
OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate ( OnUpdateSchedule ) ;
ousd . BeginInvoke ( OnUpdateScheduleCallback , null ) ;
return ;
}
// if event is BSDX SCHEDULE
else if ( e . BMXEvent = = "BSDX SCHEDULE" )
{
//See if any of the resources in the event argument matches BSDX Schedule.
//If yes, fire off the delegate
string sResourceName ;
for ( int j = 0 ; j < m_Document . m_sResourcesArray . Count ; j + + )
{
sResourceName = m_Document . m_sResourcesArray [ j ] . ToString ( ) ;
if ( e . BMXParam = = sResourceName )
{
Debug . Write ( "CGView caught BSDX SCHEDULE event.\n" ) ;
//Create a delegate to OnUpdateSchedule and call Async
//Once Async Call is done, go to OnUpdateScheduleCallb
OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate ( OnUpdateSchedule ) ;
ousd . BeginInvoke ( OnUpdateScheduleCallback , null ) ;
break ;
}
}
}
}
catch ( Exception ex )
{
Debug . Write ( ex . Message ) ;
}
}
/// <summary>
/// Update Appointments and Availabilites using Document.RefreshDocumentAsync on a different thread
/// </summary>
/// <remarks>
/// This method is expected to be called asynchornously.
/// </remarks>
2009-11-30 03:53:28 -05:00
public void OnUpdateSchedule ( )
{
try
{
2011-01-20 09:32:28 -05:00
m_Document . RefreshDocumentAsync ( ) ; //new
2009-11-30 03:53:28 -05:00
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Unable to refresh document " + ex . Message , "Clinical Scheduling" ) ;
2009-11-30 03:53:28 -05:00
}
}
2011-01-20 09:32:28 -05:00
/// <summary>
/// Callback for when OnUpdateSchedule is done. Triggers the Grid to redraw itself by calling UpdateArrays.
/// </summary>
/// <param name="itfAR">not used</param>
/// <remarks>Calls UpdateArrays via this.Invoke to make sure that the grid is redrawn on the UI thread</remarks>
private void OnUpdateScheduleCallback ( IAsyncResult itfAR )
{
OnUpdateScheduleDelegate d = new OnUpdateScheduleDelegate ( UpdateArrays ) ;
2011-02-21 09:21:24 -05:00
//try catch just in case that the view closed in the meantime.
try
{
this . Invoke ( d ) ;
}
catch ( InvalidOperationException )
{
return ;
}
2011-01-20 09:32:28 -05:00
}
/// <summary>
/// Create a new event in RPMS. Wrapper around BMXConnectInfo.RaiseEvent
/// </summary>
/// <param name="sEvent">Name of Event to Raise</param>
/// <param name="sParams">Parameter of Event to Raise</param>
public void RaiseRPMSEvent ( string sEvent , string sParams )
{
try
{
//Signal RPMS to raise an event
2011-03-29 05:46:30 -04:00
m_ConnectInfo . RaiseEvent ( sEvent , sParams , false ) ;
2011-01-20 09:32:28 -05:00
}
catch ( Exception ex )
{
Debug . Write ( ex . Message ) ;
}
}
#endregion
2010-07-07 06:19:16 -04:00
/// <summary>
/// This is how you set how the grid will look
/// </summary>
2009-11-30 03:53:28 -05:00
public void UpdateArrays ( )
{
2011-01-16 05:41:21 -05:00
// Make sure that we are called synchronously
2009-11-30 03:53:28 -05:00
Debug . Assert ( this . InvokeRequired = = false , "CGView.UpdateArrays InvokeRequired" ) ;
2010-07-04 01:25:13 -04:00
// This is where you set how the grid will look
2011-01-26 06:01:39 -05:00
//Create Deep copy of Availability Array
ArrayList availArrayCopy = new ArrayList ( ) ;
foreach ( CGAvailability av in this . m_Document . AvailabilityArray )
availArrayCopy . Add ( av ) ;
2009-11-30 03:53:28 -05:00
try
{
2011-01-20 09:32:28 -05:00
//Tell the grid about Avails, Appts, and Resources.
2011-01-26 06:01:39 -05:00
this . calendarGrid1 . AvailabilityArray = availArrayCopy ;
2011-01-20 09:32:28 -05:00
//Appts are cloned b/c if we tie into the class directly, we shoot off errors when we manipulate it.
2011-01-26 06:01:39 -05:00
this . calendarGrid1 . Appointments = ( CGAppointments ) this . m_Document . Appointments . Clone ( ) ;
2009-11-30 03:53:28 -05:00
this . calendarGrid1 . Resources = this . m_Document . Resources ;
2011-01-20 09:32:28 -05:00
//Redraw the calendar grid
2010-07-04 01:25:13 -04:00
this . calendarGrid1 . OnUpdateArrays ( ) ; // this draws the Calendar
2009-11-30 03:53:28 -05:00
this . lblResource . Text = this . m_Document . DocName ;
this . calendarGrid1 . Invalidate ( ) ;
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Unable to update arrays " + ex . Message , "Clinical Scheduling" ) ;
2009-11-30 03:53:28 -05:00
}
}
private void SchedulingManagement ( )
{
try
{
bool bLock = DocManager . ConnectInfo . Lock ( "^BSDXMGR" , "+" , "" ) ;
if ( bLock = = false )
{
throw new Exception ( "Another user is currently in Scheduling Management. Try later." ) ;
}
DManagement dMgm = new DManagement ( ) ;
dMgm . InitializeDialog ( this . m_DocManager ) ;
if ( dMgm . ShowDialog ( this ) = = DialogResult . Cancel )
{
}
m_DocManager . GlobalDataSet . Tables [ "ResourceUser" ] . Clear ( ) ;
m_DocManager . LoadResourceUserTable ( false ) ;
bLock = DocManager . ConnectInfo . bmxNetLib . Lock ( "^BSDXMGR" , "-" ) ;
}
catch ( ApplicationException aex )
{
string sMsg = aex . Message ;
MessageBox . Show ( "Unable to acquire transmit lock. Try later." ) ;
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Scheduling Management Error: " + ex . Message , "Clinical Scheduling" ) ;
2009-11-30 03:53:28 -05:00
}
}
public void UpdateTree ( )
{
this . tvSchedules . Nodes . Clear ( ) ;
this . LoadTree ( ) ;
}
public void ViewPatientAppointments ( )
{
try
{
//Display a dialog to collect Patient Name
DPatientLookup dPat = new DPatientLookup ( ) ;
dPat . DocManager = m_DocManager ;
if ( dPat . ShowDialog ( this ) = = DialogResult . Cancel )
{
return ;
}
Debug . Assert ( dPat . PatientIEN ! = "" ) ;
int nPatientID = Convert . ToInt32 ( dPat . PatientIEN ) ;
ViewPatientAppointments ( nPatientID ) ;
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( this , ex . Message , "Clinical Scheduling" , MessageBoxButtons . OK , MessageBoxIcon . Exclamation ) ;
2009-11-30 03:53:28 -05:00
}
}
public void ViewPatientAppointments ( int PatientID )
{
DPatientApptDisplay dPa = new DPatientApptDisplay ( ) ;
dPa . InitializeForm ( this . DocManager , PatientID ) ;
if ( dPa . ShowDialog ( this ) ! = DialogResult . Cancel )
{
}
}
private void FindAvailableAppointment ( ArrayList alResourceArray )
{
DApptSearch dSearch = new DApptSearch ( ) ;
dSearch . InitializePage ( alResourceArray , this . m_DocManager ) ;
if ( dSearch . ShowDialog ( this ) = = DialogResult . Cancel )
return ;
2011-03-03 04:44:18 -05:00
CGAvailability av = dSearch . SelectedAvailability ;
2009-11-30 03:53:28 -05:00
ArrayList alResource = new ArrayList ( ) ;
2011-03-03 04:44:18 -05:00
alResource . Add ( av . ResourceList ) ;
DateTime sDate = av . StartTime ;
m_sDocName = av . ResourceList ;
2009-11-30 03:53:28 -05:00
OpenSelectedSchedule ( alResource , sDate ) ;
}
#endregion Methods
#region Events
2011-01-20 09:32:28 -05:00
/// <summary>
/// Special import to get the GetActiveWindow method from Win32
/// </summary>
/// <returns>Windows Handle number for Foregreound Active Window</returns>
[DllImport("user32.dll")]
static extern IntPtr GetActiveWindow ( ) ;
/// <summary>
/// If a mouse enters the grid, check if the grid is on the active form first before stealing the focus
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void calendarGrid1_MouseEnter ( object sender , EventArgs e )
{
if ( GetActiveWindow ( ) = = this . Handle )
calendarGrid1 . Focus ( ) ;
}
2011-03-20 03:22:11 -04:00
/// <summary>
/// If mouse enters the Tree Section, check if the grid is on the active form first before stealing the focus
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tvSchedules_MouseEnter ( object sender , EventArgs e )
{
if ( GetActiveWindow ( ) = = this . Handle )
tvSchedules . Focus ( ) ;
}
2011-01-20 09:32:28 -05:00
private void CGView_Load ( object sender , System . EventArgs e )
2009-11-30 03:53:28 -05:00
{
Debug . Assert ( this . Document ! = null ) ;
//Register the view
CGDocumentManager . Current . RegisterDocumentView ( this . Document , this ) ;
//Load the Group-Resource treeview
LoadTree ( ) ;
this . SetDesktopLocation ( this . DesktopLocation . X + 10 , this . DesktopLocation . Y + 10 ) ;
2011-01-19 09:02:59 -05:00
//Show the Form
this . Activate ( ) ;
2011-03-20 03:22:11 -04:00
//Set focus on the calendar grid
this . calendarGrid1 . Focus ( ) ;
2009-11-30 03:53:28 -05:00
}
private void mnuOpenSchedule_Click ( object sender , System . EventArgs e )
{
CreateNewSchedule ( ) ;
}
private void mnu1Day_Click ( object sender , System . EventArgs e )
{
DateTime dtPicker = dateTimePicker1 . Value ;
DateTime DayOnly = new DateTime ( dtPicker . Year , dtPicker . Month , dtPicker . Day ) ;
this . calendarGrid1 . StartDate = DayOnly ;
this . calendarGrid1 . Columns = 1 ;
}
private void mnu5Day_Click ( object sender , System . EventArgs e )
{
if ( this . calendarGrid1 . Columns = = 1 )
{
this . StartDate = this . Document . StartDate ;
}
this . calendarGrid1 . Columns = 5 ;
this . Document . m_nColumnCount = 5 ; // MJL 1/17/2007
2011-01-16 05:41:21 -05:00
RequestRefreshGrid ( ) ;
2009-11-30 03:53:28 -05:00
}
private void mnu7Day_Click ( object sender , System . EventArgs e )
{
this . calendarGrid1 . Columns = 7 ;
this . Document . m_nColumnCount = 7 ; // MJL 1/17/2007
2011-01-16 05:41:21 -05:00
RequestRefreshGrid ( ) ;
2009-11-30 03:53:28 -05:00
}
private void mnu10Minute_Click ( object sender , System . EventArgs e )
{
CalendarGrid cg = this . calendarGrid1 ;
cg . TimeScale = 10 ;
2011-01-17 09:25:48 -05:00
cg . PositionGrid ( 7 ) ;
2009-11-30 03:53:28 -05:00
}
private void mnu15Minute_Click ( object sender , System . EventArgs e )
{
CalendarGrid cg = this . calendarGrid1 ;
cg . TimeScale = 15 ;
2011-01-17 09:25:48 -05:00
cg . PositionGrid ( 7 ) ;
2009-11-30 03:53:28 -05:00
}
private void mnu20Minute_Click ( object sender , System . EventArgs e )
{
CalendarGrid cg = this . calendarGrid1 ;
cg . TimeScale = 20 ;
2011-01-17 09:25:48 -05:00
cg . PositionGrid ( 7 ) ;
2009-11-30 03:53:28 -05:00
}
private void mnu30Minute_Click ( object sender , System . EventArgs e )
{
CalendarGrid cg = this . calendarGrid1 ;
cg . TimeScale = 30 ;
2011-01-17 09:25:48 -05:00
cg . PositionGrid ( 7 ) ;
2009-11-30 03:53:28 -05:00
}
private void mnuViewScheduleTree_Click ( object sender , System . EventArgs e )
{
this . mnuViewScheduleTree . Checked = this . tvSchedules . Visible ;
this . tvSchedules . Visible = ! ( this . tvSchedules . Visible ) ;
this . mnuViewScheduleTree . Checked = ! ( this . mnuViewScheduleTree . Checked ) ;
}
2011-03-20 03:22:11 -04:00
2009-11-30 03:53:28 -05:00
private void tvSchedules_DoubleClick ( object sender , System . EventArgs e )
{
if ( m_alSelectedTreeResourceArray = = null )
return ;
if ( m_alSelectedTreeResourceArray . Count < 1 )
{
if ( this . tvSchedules . SelectedNode . Text ! = "" )
{
SetResourceArrayFromGroup ( tvSchedules . SelectedNode . Text ) ;
}
else
{
return ;
}
}
OpenSelectedSchedule ( m_alSelectedTreeResourceArray , DateTime . Today ) ;
}
//20041109 Added
private void SetResourceArrayFromGroup ( string sGroup )
{
//Navigate from ResourceGroup table to Resources table
DataRow [ ] arrRows ;
DataRelation dr = DocManager . GlobalDataSet . Relations [ "GroupResource" ] ;
DataRow r = DocManager . GlobalDataSet . Tables [ "ResourceGroup" ] . Rows . Find ( sGroup ) ;
arrRows = r . GetChildRows ( dr ) ;
for ( int i = 0 ; i < arrRows . Length ; i + + )
{
string sResource = arrRows [ i ] [ "RESOURCE_NAME" ] . ToString ( ) ;
m_alSelectedTreeResourceArray . Add ( sResource ) ;
}
m_sDocName = sGroup ;
}
public void SyncTree ( )
{
}
2011-03-20 03:22:11 -04:00
2009-11-30 03:53:28 -05:00
private void tvSchedules_AfterSelect ( object sender , System . Windows . Forms . TreeViewEventArgs e )
2011-03-20 03:22:11 -04:00
{
2009-11-30 03:53:28 -05:00
m_alSelectedTreeResourceArray = new ArrayList ( ) ;
string sResource = e . Node . FullPath ;
string [ ] ss = sResource . Split ( ( char ) 92 ) ;
int l = ss . GetUpperBound ( 0 ) ;
if ( l = = 0 ) //a resource group was checked, so get all underying resources
{
SetResourceArrayFromGroup ( ss [ 0 ] ) ;
}
else
{
sResource = ss [ l ] ;
m_alSelectedTreeResourceArray . Add ( ss [ 1 ] ) ;
}
m_sDocName = ss [ l ] ;
return ;
}
2011-03-20 03:22:11 -04:00
/// <summary>
/// Makes sure that the node gets selected no matter where we click.
/// Incidentally, Invokes AfterSelect event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tvSchedules_NodeMouseClick ( object sender , TreeNodeMouseClickEventArgs e )
{
e . Node . TreeView . SelectedNode = e . Node ;
}
/// <summary>
/// Useless code now... Good place to test something.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2009-11-30 03:53:28 -05:00
private void mnuTest1_Click ( object sender , System . EventArgs e )
{
ReaderWriterLock m_rwl = this . DocManager . ConnectInfo . bmxNetLib . BMXRWL ;
try
{
m_rwl . AcquireWriterLock ( 50 ) ;
Debug . Write ( "\nTest Button 1 Acquired first lock\n" ) ;
m_rwl . AcquireWriterLock ( 50 ) ;
Debug . Write ( "Test Button 1 Acquired second lock\n" ) ;
this . DocManager . ViewRefresh ( ) ;
Thread . Sleep ( 5000 ) ;
try
{
}
catch
{
}
finally
{
m_rwl . ReleaseWriterLock ( ) ;
Debug . Write ( "Test Button 1 released first lock.\n" ) ;
m_rwl . ReleaseWriterLock ( ) ;
Debug . Write ( "Test Button 1 released second lock.\n" ) ;
}
return ;
}
catch ( Exception ex )
{
Debug . Write ( "Test Button 1 exception: " + ex . Message + "\n" ) ;
}
}
private void CGView_Closing ( object sender , System . ComponentModel . CancelEventArgs e )
{
try
{
m_ConnectInfo . BMXNetEvent - = m_bmxDelegate ;
this . calendarGrid1 . CloseGrid ( ) ;
}
catch ( Exception ex )
{
Debug . Write ( "CGView_Closing exception: " + ex . Message + "\n" ) ;
}
}
private void mnuViewRightPanel_Click ( object sender , System . EventArgs e )
{
this . mnuViewRightPanel . Checked = this . panelRight . Visible ;
this . panelRight . Visible = ! ( this . panelRight . Visible ) ;
this . mnuViewRightPanel . Checked = ! ( this . mnuViewRightPanel . Checked ) ;
}
private void calendarGrid1_CGSelectionChanged ( object sender , IndianHealthService . ClinicalScheduling . CGSelectionChangedArgs e )
{
2011-03-20 03:22:11 -04:00
CGAvailability resultantAvail ;
m_nSlots = m_Document . SlotsAvailable ( e . StartTime , e . EndTime , e . Resource , this . calendarGrid1 . TimeScale , out resultantAvail ) ;
UpdateStatusBar ( e . StartTime , e . EndTime , resultantAvail ) ;
2009-11-30 03:53:28 -05:00
}
2011-01-27 02:46:45 -05:00
/// <summary>
/// Fired during drag and drop, on the drop action.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2009-11-30 03:53:28 -05:00
private void calendarGrid1_CGAppointmentChanged ( object sender , IndianHealthService . ClinicalScheduling . CGAppointmentChangedArgs e )
{
try
{
2011-05-08 05:17:53 -04:00
// added April 13 2011
// Can't edit radiology appointments (Why? b/c it's intimately tied to Radiology Entry of the Hosp Loc)
if ( e . Appointment . RadiologyExamIEN . HasValue & & e . Appointment . RadiologyExamIEN . Value > 0 )
{
MessageBox . Show ( "You cannot move a radiology appointment." , "Clinical Scheduling" ) ;
return ;
}
// added May 5 2011
// Can't move an appointment to a radiology resource
if ( IsThisARadiologyResource ( e . Resource ) )
{
MessageBox . Show ( "You cannot move an appointment to a radiology location." , "Clinical Scheduling" ) ;
return ;
}
2009-11-30 03:53:28 -05:00
if ( e . Appointment . CheckInTime . Ticks > 0 )
{
2011-05-08 05:17:53 -04:00
MessageBox . Show ( "You cannot change the appointment time because the patient has already checked in." , "Clinical Scheduling" ) ;
2009-11-30 03:53:28 -05:00
return ;
}
2010-09-28 09:40:17 -04:00
// Added check for making Walk-ins/appts in the past. 9/28/2010 //smh
if ( e . StartTime < DateTime . Today . Date )
{
var result = MessageBox . Show ( "Are you sure you want to make an appointment in the past?" , "Windows Scheduling" , MessageBoxButtons . YesNo , MessageBoxIcon . Exclamation , MessageBoxDefaultButton . Button2 ) ;
if ( result = = DialogResult . No ) return ;
}
2011-01-27 02:46:45 -05:00
//Can user edit destination resource?
2009-11-30 03:53:28 -05:00
if ( EditAppointmentEnabled ( e . Resource ) = = false )
return ;
2011-01-27 02:46:45 -05:00
//Can user edit original schedule?
2009-11-30 03:53:28 -05:00
if ( EditAppointmentEnabled ( e . Appointment . Resource ) = = false )
return ;
2009-11-30 23:54:57 -05:00
if ( MessageBox . Show ( "Are you sure you want to move this appointment?" , "Clinical Scheduling" , MessageBoxButtons . YesNo ) ! = DialogResult . Yes )
2009-11-30 03:53:28 -05:00
return ;
//20040909 Cherokee Replaced this block with following
// if (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) < 1)
// {
// MessageBox.Show("There are no appointment slots available for the selected time.");
// return;
// }
bool bOverbook = false ;
if ( m_htOverbook . Count > 0 )
{
bOverbook = ( bool ) this . m_htOverbook [ e . Resource . ToString ( ) ] ;
}
bool bModSchedule = false ;
if ( m_htModifySchedule . Count > 0 )
{
bModSchedule = ( bool ) this . m_htModifySchedule [ e . Resource . ToString ( ) ] ;
}
2011-03-20 03:22:11 -04:00
CGAvailability resultantAvail ;
bool bSlotsAvailable = ( m_Document . SlotsAvailable ( e . StartTime , e . EndTime , e . Resource , this . calendarGrid1 . TimeScale , out resultantAvail ) > 0 ) ;
2009-11-30 03:53:28 -05:00
if ( ! ( ( bSlotsAvailable ) | | ( bModSchedule ) | | ( bOverbook ) ) )
{
MessageBox . Show ( "There are no appointment slots available for the selected time." ) ;
return ;
}
/ *
* 7 - 19 - 05 Added overbook prompt
* /
if ( bSlotsAvailable = = false )
{
2009-11-30 23:54:57 -05:00
DialogResult dr = MessageBox . Show ( this , "There are no slots available at the selected time. Do you want to overbook this appointment?" , "Clinical Scheduling" , MessageBoxButtons . YesNo ) ;
2009-11-30 03:53:28 -05:00
if ( dr ! = DialogResult . Yes )
{
return ;
}
}
2011-01-27 02:46:45 -05:00
//Create a new appointment using old data for patient demographics and note and new data
//for StartTime, EndTime, Resource, AccessTypeID
CGAppointment appt = new CGAppointment ( ) ;
appt . PatientID = e . Appointment . PatientID ;
appt . PatientName = e . Appointment . PatientName ;
appt . StartTime = e . StartTime ;
appt . EndTime = e . EndTime ;
appt . Resource = e . Resource ;
appt . Note = e . Appointment . Note ;
appt . HealthRecordNumber = e . Appointment . HealthRecordNumber ;
appt . AccessTypeID = e . AccessTypeID ;
2011-04-14 08:33:14 -04:00
appt . Patient = e . Appointment . Patient ;
2011-01-27 02:46:45 -05:00
this . Document . CreateAppointment ( appt ) ;
//CGAppointment a = new CGAppointment();
//a.StartTime = e.StartTime;
////e.Appointment.StartTime = e.StartTime
//a.EndTime = e.EndTime;
////e.Appointment.EndTime = e.EndTime;
//a.Resource = e.Resource;
////e.Appointment.Resource = e.Resource;
//a.AccessTypeID = e.AccessTypeID;
////e.Appointment.AccessTypeID = e.AccessTypeID;
//m_Document.CreateAppointment(a);
2009-11-30 03:53:28 -05:00
2010-09-28 09:40:17 -04:00
string sError = AppointmentDeleteOne ( e . Appointment . AppointmentKey ) ;
if ( sError ! = "" )
2009-11-30 03:53:28 -05:00
{
MessageBox . Show ( sError ) ;
return ;
}
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Unable to change appointment " + ex . Message , "Clinical Scheduling" ) ;
2011-01-27 02:46:45 -05:00
//this.m_DocManager.UpdateViews();
2009-11-30 03:53:28 -05:00
return ;
}
finally
{
2011-01-27 02:46:45 -05:00
this . UpdateArrays ( ) ;
2009-11-30 03:53:28 -05:00
}
try
{
RaiseRPMSEvent ( "BSDX SCHEDULE" , e . Resource ) ;
if ( e . Resource ! = e . OldResource )
RaiseRPMSEvent ( "BSDX SCHEDULE" , e . OldResource ) ;
2011-01-27 02:46:45 -05:00
//That will take too long. Don't do it. Try and see what happens when you come
//this.m_DocManager.UpdateViews(e.Resource, e.OldResource);
2009-11-30 03:53:28 -05:00
}
catch ( Exception ex )
{
Debug . Write ( ex . Message ) ;
}
}
private void mnuSchedulingManagment_Click ( object sender , System . EventArgs e )
{
SchedulingManagement ( ) ;
}
private void mnuFile_Popup ( object sender , System . EventArgs e )
{
this . mnuSchedulingManagment . Enabled = DocManager . ScheduleManager ;
}
private void mnuFindAppt_Click ( object sender , System . EventArgs e )
{
FindAvailableAppointment ( this . Document . Resources ) ;
}
private void mnuRPMSServer_Click ( object sender , System . EventArgs e )
{
//Handled by DocumentManager class
}
private void mnuRPMSLogin_Click ( object sender , System . EventArgs e )
{
//Handled by DocumentManager class
}
private void CGView_Activated ( object sender , System . EventArgs e )
{
calendarGrid1 . GridEnter = true ;
}
private void mnuHelpAbout_Click ( object sender , System . EventArgs e )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Clinical Scheduling Version " + Application . ProductVersion , "Clinical Scheduling" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
2009-11-30 03:53:28 -05:00
}
private void ImplementMsg ( )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Clinical Scheduling" , "TODO: Implement this function" ) ;
2009-11-30 03:53:28 -05:00
}
private void mnuClose_Click ( object sender , System . EventArgs e )
{
DialogResult dr = MessageBox . Show ( "Are you sure you want to close this schedule?" , Application . ProductName , MessageBoxButtons . OKCancel ) ;
if ( dr ! = DialogResult . OK )
return ;
this . Close ( ) ;
}
private void mnuViewPatientAppts_Click ( object sender , System . EventArgs e )
{
ViewPatientAppointments ( ) ;
}
private void lstClip_DragEnter ( object sender , System . Windows . Forms . DragEventArgs e )
{
bool b = e . Data . GetDataPresent ( typeof ( CGAppointment ) ) ;
if ( b = = true )
{
e . Effect = DragDropEffects . Move ;
}
else
{
e . Effect = DragDropEffects . None ;
}
}
private void lstClip_DragDrop ( object sender , System . Windows . Forms . DragEventArgs e )
{
try
{
CGAppointment a = ( CGAppointment ) e . Data . GetData ( typeof ( CGAppointment ) ) ;
if ( m_ClipList . AppointmentTable . Contains ( ( int ) a . AppointmentKey ) )
{
return ;
}
2011-05-16 07:31:39 -04:00
if ( a . RadiologyExamIEN . HasValue )
{
MessageBox . Show ( "Cannot move a radiology appointment to the clipboard" ) ;
return ;
}
2009-11-30 03:53:28 -05:00
m_ClipList . AddAppointment ( a ) ;
lstClip . Items . Add ( a ) ;
}
catch ( Exception ex )
{
Debug . Write ( ex . Message ) ;
}
}
private void lstClip_MouseDown ( object sender , System . Windows . Forms . MouseEventArgs e )
{
m_bDragDropStart = false ;
}
private void lstClip_MouseMove ( object sender , System . Windows . Forms . MouseEventArgs e )
{
try
{
if ( ( m_bDragDropStart = = false ) & & ( lstClip . SelectedIndex > - 1 ) )
{
CGAppointment a = ( CGAppointment ) lstClip . Items [ lstClip . SelectedIndex ] ;
this . calendarGrid1 . ApptDragSource = "list" ;
DragDropEffects effect = DoDragDrop ( a , DragDropEffects . Move ) ;
m_bDragDropStart = true ;
}
}
catch ( Exception ex )
{
Debug . Write ( ex . Message ) ;
}
}
private void calendarGrid1_CGAppointmentAdded ( object sender , IndianHealthService . ClinicalScheduling . CGAppointmentChangedArgs e )
{
try
{
bool bSlotsAvailable ;
bool bOverbook ;
bool bModSchedule ;
bool bModAppts ;
if ( this . EditAppointmentEnabled ( e . Appointment . Resource ) = = false )
return ;
bModAppts = ( bool ) this . m_htChangeAppts [ e . Resource . ToString ( ) ] ;
if ( bModAppts = = false )
return ;
2010-09-28 09:40:17 -04:00
// Added check for making Walk-ins/appts in the past. 9/28/2010 //smh
if ( e . StartTime < DateTime . Today . Date )
{
var result = MessageBox . Show ( "Are you sure you want to make an appointment in the past?" , "Windows Scheduling" , MessageBoxButtons . YesNo , MessageBoxIcon . Exclamation , MessageBoxDefaultButton . Button2 ) ;
if ( result = = DialogResult . No ) return ;
}
2009-11-30 03:53:28 -05:00
bOverbook = ( bool ) this . m_htOverbook [ e . Resource . ToString ( ) ] ;
bModSchedule = ( bool ) this . m_htModifySchedule [ e . Resource . ToString ( ) ] ;
2011-03-20 03:22:11 -04:00
CGAvailability resultantAvail ;
bSlotsAvailable = ( m_Document . SlotsAvailable ( e . StartTime , e . EndTime , e . Resource , this . calendarGrid1 . TimeScale , out resultantAvail ) > 0 ) ;
2009-11-30 03:53:28 -05:00
if ( ! ( ( bSlotsAvailable ) | | ( bModSchedule ) | | ( bOverbook ) ) )
{
MessageBox . Show ( "There are no appointment slots available for the selected time." ) ;
return ;
}
/ *
* 7 - 19 - 05 Added overbook prompt
* /
if ( bSlotsAvailable = = false )
{
2009-11-30 23:54:57 -05:00
DialogResult dr = MessageBox . Show ( this , "There are no slots available at the selected time. Do you want to overbook this appointment?" , "Clinical Scheduling" , MessageBoxButtons . YesNo ) ;
2009-11-30 03:53:28 -05:00
if ( dr ! = DialogResult . Yes )
{
return ;
}
}
e . Appointment . StartTime = e . StartTime ;
e . Appointment . EndTime = e . EndTime ;
e . Appointment . Resource = e . Resource ;
e . Appointment . AccessTypeID = e . AccessTypeID ;
m_Document . CreateAppointment ( e . Appointment ) ;
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( "Unable to add new appointment " + ex . Message , "Clinical Scheduling" ) ;
2009-11-30 03:53:28 -05:00
return ;
}
try
{
RaiseRPMSEvent ( "BSDX SCHEDULE" , e . Resource ) ;
if ( e . Resource ! = e . OldResource )
RaiseRPMSEvent ( "BSDX SCHEDULE" , e . OldResource ) ;
this . m_DocManager . UpdateViews ( e . Resource , e . OldResource ) ;
}
catch ( Exception ex )
{
Debug . Write ( ex . Message ) ;
}
}
private void lstClip_SelectedIndexChanged ( object sender , System . EventArgs e )
{
}
private void mnuPrintClinicSchedules_Click ( object sender , System . EventArgs e )
{
try
{
DSelectLetterClinics ds = new DSelectLetterClinics ( ) ;
ds . InitializePage ( this . m_DocManager . GlobalDataSet , "Print Clinic Schedules" ) ;
ds . SetupForReports ( ) ;
if ( ds . ShowDialog ( this ) ! = DialogResult . OK )
return ;
//get the resource names and call the letter printer
string sClinics = ds . SelectedClinics ;
DateTime dtBegin = ds . BeginDate ;
DateTime dtEnd = ds . EndDate ;
DPatientLetter dpl = new DPatientLetter ( ) ;
dpl . InitializeFormClinicSchedule ( this . DocManager , sClinics , dtBegin , dtEnd ) ;
dpl . ShowDialog ( this ) ;
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( this , ex . Message , "Clinical Scheduling" , MessageBoxButtons . OK , MessageBoxIcon . Exclamation ) ;
2009-11-30 03:53:28 -05:00
}
}
2010-06-04 22:19:48 -04:00
private void mnuPrintReminderLetters_Click ( object sender , System . EventArgs e )
2009-11-30 03:53:28 -05:00
{
try
{
DSelectLetterClinics ds = new DSelectLetterClinics ( ) ;
ds . InitializePage ( this . m_DocManager . GlobalDataSet , "Print Reminder Letters" ) ;
if ( ds . ShowDialog ( this ) ! = DialogResult . OK )
return ;
//get the resource names and call the letter printer
string sClinics = ds . SelectedClinics ;
DateTime dtBegin = ds . BeginDate ;
DateTime dtEnd = ds . EndDate ;
DPatientLetter dpl = new DPatientLetter ( ) ;
2010-06-04 22:19:48 -04:00
dpl . InitializeFormPatientReminderLetters ( this . DocManager , sClinics , dtBegin , dtEnd ) ;
2009-11-30 03:53:28 -05:00
dpl . ShowDialog ( this ) ;
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( this , ex . Message , "Clinical Scheduling" , MessageBoxButtons . OK , MessageBoxIcon . Exclamation ) ;
2009-11-30 03:53:28 -05:00
}
}
private void mnuPrintRebookLetters_Click ( object sender , System . EventArgs e )
{
try
{
DSelectLetterClinics ds = new DSelectLetterClinics ( ) ;
ds . InitializePage ( this . m_DocManager . GlobalDataSet , "Print Clinic Rebook Letters" ) ;
if ( ds . ShowDialog ( this ) ! = DialogResult . OK )
return ;
2010-06-04 22:19:48 -04:00
//Call the letter printer
2009-11-30 03:53:28 -05:00
DPatientLetter dpl = new DPatientLetter ( ) ;
2010-06-04 22:19:48 -04:00
dpl . InitializeFormRebookLetters ( this . DocManager , ds . SelectedClinics , ds . BeginDate , ds . EndDate ) ;
2009-11-30 03:53:28 -05:00
dpl . ShowDialog ( this ) ;
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( this , ex . Message , "Clinical Scheduling" , MessageBoxButtons . OK , MessageBoxIcon . Exclamation ) ;
2009-11-30 03:53:28 -05:00
}
}
private void mnuPrintPatientLetter_Click ( object sender , System . EventArgs e )
{
2010-05-21 21:03:45 -04:00
ViewPatientAppointments ( ) ;
2009-11-30 03:53:28 -05:00
}
private void mnuRPMSDivision_Click ( object sender , System . EventArgs e )
{
this . DocManager . ChangeDivision ( this ) ;
}
private void CGView_CursorChanged ( object sender , System . EventArgs e )
{
}
private void mnuDisplayWalkIns_Click ( object sender , System . EventArgs e )
{
calendarGrid1 . DrawWalkIns = ! ( calendarGrid1 . DrawWalkIns ) ;
mnuDisplayWalkIns . Checked = calendarGrid1 . DrawWalkIns ;
calendarGrid1 . SetOverlapTable ( ) ;
calendarGrid1 . Refresh ( ) ;
}
private void mnuOpenMultipleSchedules_Click ( object sender , System . EventArgs e )
{
try
{
DSelectSchedules ds = new DSelectSchedules ( ) ;
ds . InitializePage ( this . m_DocManager . GlobalDataSet , "Open Multiple Schedules" ) ;
if ( ds . ShowDialog ( this ) ! = DialogResult . OK )
return ;
//get the resource names and open schedules
ArrayList sResources = ds . SelectedClinics ;
if ( ds . SingleWindow = = true )
{
m_sDocName = ( ds . GroupWindowName = = "" ) ? "Multiple Selected Schedules" : ds . GroupWindowName ;
OpenSelectedSchedule ( sResources , DateTime . Today ) ;
}
else
{
foreach ( string sResource in sResources )
{
ArrayList alSingle = new ArrayList ( 1 ) ;
alSingle . Add ( sResource ) ;
m_sDocName = sResource ;
OpenSelectedSchedule ( alSingle , DateTime . Today ) ;
}
}
return ;
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( this , ex . Message , "Clinical Scheduling" , MessageBoxButtons . OK , MessageBoxIcon . Exclamation ) ;
2009-11-30 03:53:28 -05:00
}
}
private void ctxCalGridWalkin_Click ( object sender , System . EventArgs e )
{
AppointmentAddWalkin ( ) ;
}
private void mnuWalkIn_Click ( object sender , System . EventArgs e )
{
AppointmentAddWalkin ( ) ;
}
private void mnuPrintCancellationLetters_Click ( object sender , System . EventArgs e )
{
try
{
DSelectLetterClinics ds = new DSelectLetterClinics ( ) ;
ds . InitializePage ( this . m_DocManager . GlobalDataSet , "Print Clinic Cancellation Letters" ) ;
if ( ds . ShowDialog ( this ) ! = DialogResult . OK )
return ;
//get the resource names and call the letter printer
string sClinics = ds . SelectedClinics ;
DateTime dtBegin = ds . BeginDate ;
DateTime dtEnd = ds . EndDate ;
DPatientLetter dpl = new DPatientLetter ( ) ;
2010-06-04 22:19:48 -04:00
dpl . InitializeFormCancellationLetters ( this . DocManager , sClinics , dtBegin , dtEnd ) ;
2009-11-30 03:53:28 -05:00
dpl . ShowDialog ( this ) ;
}
catch ( Exception ex )
{
2009-11-30 23:54:57 -05:00
MessageBox . Show ( this , ex . Message , "Clinical Scheduling" , MessageBoxButtons . OK , MessageBoxIcon . Exclamation ) ;
2009-11-30 03:53:28 -05:00
}
}
2011-03-23 05:15:51 -04:00
private void PrintRoutingSlip ( CGAppointment appt )
2010-06-19 12:41:06 -04:00
{
2011-03-24 09:26:14 -04:00
//get this appointment's order
//Today's appointments
var todaysAppts = ( from lkappts in this . Document . Appointments . AppointmentTable . Values . Cast < CGAppointment > ( )
2011-03-30 06:18:19 -04:00
where lkappts . StartTime > appt . StartTime . Date & & lkappts . StartTime < appt . StartTime . AddDays ( 1 ) . Date & & lkappts . Resource = = appt . Resource
2011-03-24 09:26:14 -04:00
orderby lkappts . StartTime
select lkappts ) . ToList ( ) ;
//Find the order of the appointment
int apptOrder = todaysAppts . FindIndex ( eachappt = > eachappt . StartTime = = appt . StartTime & & eachappt . PatientID = = appt . PatientID ) ;
//Index is zero based, so add 1
apptOrder + + ;
//Send that to the routing slip as a parameter
2011-03-23 05:15:51 -04:00
PrintDocument pd = new PrintDocument ( ) { DocumentName = "Routing Slip for Appt " + appt . AppointmentKey } ;
2011-03-24 09:26:14 -04:00
pd . PrintPage + = ( object s , System . Drawing . Printing . PrintPageEventArgs e ) = > CGDocumentManager . Current . PrintingObject . PrintRoutingSlip ( appt , apptOrder , e ) ;
2011-03-23 05:15:51 -04:00
pd . Print ( ) ;
}
private void PrintAppointmentSlip ( CGAppointment appt )
{
PrintDocument pd = new PrintDocument ( ) { DocumentName = "Appointment Slip for Appt " + appt . AppointmentKey } ; //Autoinit for DocName
pd . PrintPage + = ( object s , System . Drawing . Printing . PrintPageEventArgs e ) = > CGDocumentManager . Current . PrintingObject . PrintAppointmentSlip ( appt , e ) ;
pd . Print ( ) ;
2010-06-19 12:41:06 -04:00
}
2011-01-16 05:41:21 -05:00
2011-01-26 06:01:39 -05:00
/// <summary>
/// Update Selection of date if user does not pick a date/time
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2011-01-16 05:41:21 -05:00
private void dateTimePicker1_Leave ( object sender , EventArgs e )
{
if ( this . Document . SelectedDate ! = dateTimePicker1 . Value . Date )
RequestRefreshGrid ( ) ;
}
2009-11-30 03:53:28 -05:00
2011-01-26 06:01:39 -05:00
/// <summary>
/// Handle Selection of Date via mouse from datetimepicker dropdown
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2011-01-16 05:41:21 -05:00
private void dateTimePicker1_CloseUp ( object sender , EventArgs e )
{
if ( this . Document . SelectedDate ! = dateTimePicker1 . Value . Date )
RequestRefreshGrid ( ) ;
}
2009-11-30 03:53:28 -05:00
2011-01-26 06:01:39 -05:00
/// <summary>
/// Handle Enter and Escape key on dateTimePicker
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2011-01-16 05:41:21 -05:00
private void dateTimePicker1_KeyPress ( object sender , KeyPressEventArgs e )
{
//if enter key is pressed:
// Tell windows that we are handling this
// Request a Refresh Grid if the date is different
// Set-Focus to Calendar Grid
if ( e . KeyChar = = ( char ) Keys . Enter )
{
e . Handled = true ;
2009-11-30 03:53:28 -05:00
2011-01-16 05:41:21 -05:00
if ( this . Document . SelectedDate ! = dateTimePicker1 . Value . Date )
RequestRefreshGrid ( ) ;
this . CGrid . Focus ( ) ;
}
//if escape key is pressed:
// Tell windows that we are handling this
// Set-Focus to Calendar Grid
if ( e . KeyChar = = ( char ) Keys . Escape )
{
e . Handled = true ;
this . CGrid . Focus ( ) ;
}
}
2009-11-30 03:53:28 -05:00
2011-03-30 06:54:56 -04:00
private void mnuRefresh_Click ( object sender , EventArgs e )
{
ForceRefreshGrid ( ) ;
}
2010-06-19 12:41:06 -04:00
2011-01-16 05:41:21 -05:00
#endregion events
2011-03-23 05:15:51 -04:00
/// <summary>
/// Refresh grid if needed.
/// </summary>
2011-01-16 05:41:21 -05:00
void RequestRefreshGrid ( )
{
2011-01-18 09:15:22 -05:00
DateTime dDate = dateTimePicker1 . Value . Date ;
// Change Date on Document
2011-01-16 05:41:21 -05:00
this . Document . SelectedDate = dDate ;
2011-01-19 09:02:59 -05:00
// Do we need to update?
bool isRefreshNeeded = this . Document . IsRefreshNeeded ( ) ;
2011-01-18 09:15:22 -05:00
//Splash when loading and change Cursor
2011-01-19 09:02:59 -05:00
if ( isRefreshNeeded )
{
this . Cursor = Cursors . WaitCursor ;
LoadSplash ( ) ;
this . Document . RefreshDocument ( ) ;
StopSplash ( ) ;
this . Cursor = Cursors . Default ;
}
2011-01-18 09:15:22 -05:00
2011-01-16 05:41:21 -05:00
if ( this . Document . Resources . Count = = 1 )
{
if ( this . calendarGrid1 . Columns > 1 )
{
this . StartDate = this . Document . StartDate ;
}
else
{
this . StartDate = this . Document . SelectedDate ;
}
}
else
{
this . StartDate = this . Document . SelectedDate ;
}
2011-01-18 09:15:22 -05:00
//Is this needed? -- Yes it is. There is a bug in the drawing code for the calendar
//First time it draws, it draws appointments, but not availability slots
//Second time it draws, it both appointments and availabilites
//XXX: Need to investigate
2011-01-16 05:41:21 -05:00
this . Document . UpdateAllViews ( ) ;
2011-01-18 09:15:22 -05:00
}
2011-03-30 06:54:56 -04:00
/// <summary>
/// This forces a grid refresh.
/// </summary>
void ForceRefreshGrid ( )
{
if ( this . Document . m_sResourcesArray . Count = = 0 ) return ;
this . Cursor = Cursors . WaitCursor ;
LoadSplash ( ) ;
2011-03-30 08:28:31 -04:00
this . Document . RefreshSchedule ( ) ;
2011-03-30 06:54:56 -04:00
this . UpdateArrays ( ) ;
StopSplash ( ) ;
this . Cursor = Cursors . Default ;
}
2011-04-14 08:33:14 -04:00
//private delegate DialogResult dLoadingSplash(IWin32Window owner);
string _tempStatusBartext ;
2011-01-18 09:15:22 -05:00
/// <summary>
2011-04-14 08:33:14 -04:00
/// Loads a splash that says "Loading" -- removed it april 13 2010
2011-01-18 09:15:22 -05:00
/// </summary>
private void LoadSplash ( )
{
2011-04-14 08:33:14 -04:00
_tempStatusBartext = this . statusBar1 . Text ;
this . statusBar1 . Text = "Refreshing Schedule..." ;
//_loadingSplash = new LoadingSplash();
//_loadingSplash.StartPosition = FormStartPosition.CenterScreen; //XXX: Don't like this, but will do for now.
//_loadingSplash.UseWaitCursor = true; // tell user we are working
//_loadingSplash.Show(this);
//Thread threadSplash = new Thread(tstart);
//threadSplash.IsBackground = true;
//threadSplash.Name = "Loading Thread";
//threadSplash.Start(this);
//Thread threadSplash = new Thread(new ThreadStart(() => _loadingSplash.ShowDialog())); // lambda
//threadSplash.IsBackground = true; //expendable thread -- exit even if still running.
//threadSplash.Name = "Loading Thread";
//threadSplash.Start();
2011-01-18 09:15:22 -05:00
}
private void StopSplash ( )
{
2011-04-14 08:33:14 -04:00
this . statusBar1 . Text = _tempStatusBartext ;
2011-01-16 05:41:21 -05:00
}
2010-06-19 12:41:06 -04:00
2011-03-20 03:22:11 -04:00
2011-03-29 05:46:30 -04:00
private void PrintClinicSchedule ( DateTime dStart , DateTime dEnd )
{
DPatientLetter dpl = new DPatientLetter ( ) ;
2011-03-20 03:22:11 -04:00
2011-03-29 05:46:30 -04:00
int [ ] resourceIENs = ( from resource in CGDocumentManager . Current . GlobalDataSet . Tables [ "Resources" ] . AsEnumerable ( )
join resource_name in m_alSelectedTreeResourceArray . Cast < string > ( ) on resource . Field < string > ( "RESOURCE_NAME" ) equals resource_name
select resource . Field < int > ( "RESOURCEID" )
) . ToArray < int > ( ) ;
2011-03-20 03:22:11 -04:00
2011-03-29 05:46:30 -04:00
// + | is an oddity in the Mumps code which I haven't investigated yet.
dpl . InitializeFormClinicSchedule ( this . DocManager , string . Join ( "|" , resourceIENs ) + "|" , dStart , dEnd ) ;
dpl . ShowDialog ( this ) ;
}
2011-03-20 03:22:11 -04:00
2011-01-20 09:32:28 -05:00
2009-11-30 03:53:28 -05:00
} //End class
}