using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace IndianHealthService.ClinicalScheduling
{
///
/// Form which displays exams for User so that the user would pick one of them
/// for which to make an appointment
///
public partial class DRadExamsSelect : Form
{
//return values
public int ExamIEN { get; private set; }
public string ProcedureName { get; private set; }
public bool PrintAppointmentSlip { get { return chkPrint.Checked; } }
//end return values
//private fields
public bool _myCodeIsFiringIstheCheckBoxChangedEvent = false;
//private fields
///
/// ctor
///
/// Strongly Typed Table of Exams
public DRadExamsSelect(List _radExams)
{
InitializeComponent();
this.lstExams.DataSource = _radExams;
this.lstExams.SelectionMode = SelectionMode.One;
//Set Default Checkbox
_myCodeIsFiringIstheCheckBoxChangedEvent = true;
chkPrint.Checked = CGDocumentManager.Current.UserPreferences.PrintAppointmentSlipAutomacially;
_myCodeIsFiringIstheCheckBoxChangedEvent = false;
}
private void btnOK_Click(object sender, EventArgs e)
{
SharedFinishLine();
}
private void lstExams_MouseDoubleClick(object sender, MouseEventArgs e)
{
SharedFinishLine();
}
private void SharedFinishLine()
{
if (lstExams.SelectedIndex < 0)
{
this.DialogResult = DialogResult.None;
return;
}
ExamIEN = (lstExams.Items[lstExams.SelectedIndex] as RadiologyExam).IEN;
ProcedureName = (lstExams.Items[lstExams.SelectedIndex] as RadiologyExam).Procedure;
this.DialogResult = DialogResult.OK;
}
///
/// Save preference for Auto Printing Appointment Slip in the DB
///
///
///
private void chkPrint_CheckedChanged(object sender, EventArgs e)
{
if (_myCodeIsFiringIstheCheckBoxChangedEvent) return;
CGDocumentManager.Current.UserPreferences.PrintAppointmentSlipAutomacially = chkPrint.Checked;
}
}
}