context: using System;
  using System.Drawing;
  using System.Collections;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Globalization;
  using System.Windows.Forms;
  using OpenDentBusiness;
  
  namespace OpenDental{
  ///<summary></summary>
  	public class FormReferralEdit : System.Windows.Forms.Form{
  		private OpenDental.UI.Button butOK;
  		private OpenDental.UI.Button butCancel;
  		private System.Windows.Forms.Label label1;
  		private System.Windows.Forms.Label label2;
  		private System.Windows.Forms.Label label3;
  		private System.Windows.Forms.Label label4;
  		private System.Windows.Forms.GroupBox groupSSN;
  		private System.Windows.Forms.RadioButton radioTIN;
  		private System.Windows.Forms.RadioButton radioSSN;
  		private System.Windows.Forms.TextBox textSSN;
  		private System.Windows.Forms.ListBox listSpecialty;
  		private System.Windows.Forms.Label label10;
  		private System.Windows.Forms.TextBox textPhone3;
  		private System.Windows.Forms.Label label13;
  		private System.Windows.Forms.TextBox textPhone2;
  		private System.Windows.Forms.Label label11;
  		private System.Windows.Forms.Label label12;
  		private System.Windows.Forms.TextBox textPhone1;
  		private System.Windows.Forms.Label label14;
  		private System.Windows.Forms.TextBox textLName;
  		private System.Windows.Forms.TextBox textFName;
  		private System.Windows.Forms.TextBox textMName;
  		private System.Windows.Forms.TextBox textST;
  		private System.ComponentModel.Container components = null;
  		///<summary></summary>
  		public bool IsNew;
  		///<summary></summary>
      private bool IsPatient;
  		private System.Windows.Forms.Label label5;
  		private System.Windows.Forms.TextBox textEmail;
  		private System.Windows.Forms.TextBox textOtherPhone;
  		private System.Windows.Forms.TextBox textZip;
  		private System.Windows.Forms.TextBox textCity;
  		private System.Windows.Forms.TextBox textAddress2;
  		private System.Windows.Forms.TextBox textAddress;
  		private System.Windows.Forms.Label label22;
  		private System.Windows.Forms.Label label16;
  		private System.Windows.Forms.Label label15;
  		private System.Windows.Forms.Label label7;
  		private System.Windows.Forms.Label label8;
  		private System.Windows.Forms.Label label9;
  		private System.Windows.Forms.TextBox textTitle;
  		private System.Windows.Forms.Label label17;
  		private System.Windows.Forms.Label labelPatient;
  		private System.Windows.Forms.CheckBox checkNotPerson;
  		private OpenDental.ODtextBox textNotes;
  		private System.Windows.Forms.CheckBox checkHidden;
  		private System.Windows.Forms.GroupBox groupBox2;
  		private System.Windows.Forms.TextBox textPatientsNumTo;
  		private System.Windows.Forms.ComboBox comboPatientsTo;
  		private System.Windows.Forms.Label label6;
  		private System.Windows.Forms.Label label18;
  		private System.Windows.Forms.TextBox textPatientsNumFrom;
  		private System.Windows.Forms.ComboBox comboPatientsFrom;
  		private TextBox textNationalProvID;
  		private Label label19;
  		private Label label20;
  		private Label label21;
  		private ComboBox comboSlip;
  		///<summary></summary>
  		public Referral RefCur;
  		private UI.Button butDelete;
  		private CheckBox checkIsDoctor;
  		private CheckBox checkEmailTrustDirect;
  		private List<SheetDef> SlipList;
  
  		///<summary></summary>
  		public FormReferralEdit(Referral refCur){
  			InitializeComponent();
  			RefCur=refCur;
  			if(refCur.PatNum>0){
  				IsPatient=true;
  			}
  			Lan.F(this);
  			if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
  				groupSSN.Text=Lan.g(this,"CDA Number");
  				radioSSN.Visible=false;
  				radioTIN.Visible=false;
  			}
  		}
  
  		///<summary></summary>
  		protected override void Dispose( bool disposing ){
  			if( disposing ){
  				if(components != null){
  					components.Dispose();
  				}
  			}
  			base.Dispose( disposing );
  		}
  
  		#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()
  		{
  			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormReferralEdit));
  			this.textLName = new System.Windows.Forms.TextBox();
  			this.label1 = new System.Windows.Forms.Label();
  			this.label2 = new System.Windows.Forms.Label();
  			this.textFName = new System.Windows.Forms.TextBox();
  			this.label3 = new System.Windows.Forms.Label();
  			this.textMName = new System.Windows.Forms.TextBox();
  			this.label4 = new System.Windows.Forms.Label();
  			this.textST = new System.Windows.Forms.TextBox();
  			this.groupSSN = new System.Windows.Forms.GroupBox();
  			this.radioTIN = new System.Windows.Forms.RadioButton();
  			this.radioSSN = new System.Windows.Forms.RadioButton();
  			this.textSSN = new System.Windows.Forms.TextBox();
  			this.listSpecialty = new System.Windows.Forms.ListBox();
  			this.label10 = new System.Windows.Forms.Label();
  			this.textPhone3 = new System.Windows.Forms.TextBox();
  			this.label13 = new System.Windows.Forms.Label();
  			this.textPhone2 = new System.Windows.Forms.TextBox();
  			this.label11 = new System.Windows.Forms.Label();
  			this.label12 = new System.Windows.Forms.Label();
  			this.textPhone1 = new System.Windows.Forms.TextBox();
  			this.label14 = new System.Windows.Forms.Label();
  			this.textTitle = new System.Windows.Forms.TextBox();
  			this.label5 = new System.Windows.Forms.Label();
  			this.textEmail = new System.Windows.Forms.TextBox();
  			this.textOtherPhone = new System.Windows.Forms.TextBox();
  			this.textZip = new System.Windows.Forms.TextBox();
  			this.textCity = new System.Windows.Forms.TextBox();
  			this.textAddress2 = new System.Windows.Forms.TextBox();
  			this.textAddress = new System.Windows.Forms.TextBox();
  			this.label22 = new System.Windows.Forms.Label();
  			this.label16 = new System.Windows.Forms.Label();
  			this.label15 = new System.Windows.Forms.Label();
  			this.label7 = new System.Windows.Forms.Label();
  			this.label8 = new System.Windows.Forms.Label();
  			this.label9 = new System.Windows.Forms.Label();
  			this.label17 = new System.Windows.Forms.Label();
  			this.checkHidden = new System.Windows.Forms.CheckBox();
  			this.labelPatient = new System.Windows.Forms.Label();
  			this.checkNotPerson = new System.Windows.Forms.CheckBox();
  			this.groupBox2 = new System.Windows.Forms.GroupBox();
  			this.label18 = new System.Windows.Forms.Label();
  			this.textPatientsNumFrom = new System.Windows.Forms.TextBox();
  			this.comboPatientsFrom = new System.Windows.Forms.ComboBox();
  			this.label6 = new System.Windows.Forms.Label();
  			this.textPatientsNumTo = new System.Windows.Forms.TextBox();
  			this.comboPatientsTo = new System.Windows.Forms.ComboBox();
  			this.textNationalProvID = new System.Windows.Forms.TextBox();
  			this.label19 = new System.Windows.Forms.Label();
  			this.label20 = new System.Windows.Forms.Label();
  			this.label21 = new System.Windows.Forms.Label();
  			this.comboSlip = new System.Windows.Forms.ComboBox();
  			this.butDelete = new OpenDental.UI.Button();
  			this.textNotes = new OpenDental.ODtextBox();
  			this.butCancel = new OpenDental.UI.Button();
  			this.butOK = new OpenDental.UI.Button();
  			this.checkIsDoctor = new System.Windows.Forms.CheckBox();
  			this.checkEmailTrustDirect = new System.Windows.Forms.CheckBox();
  			this.groupSSN.SuspendLayout();
  			this.groupBox2.SuspendLayout();
  			this.SuspendLayout();
  			// 
  			// textLName
  			// 
  			this.textLName.Location = new System.Drawing.Point(129, 78);
  			this.textLName.Name = "textLName";
  			this.textLName.Size = new System.Drawing.Size(297, 20);
  			this.textLName.TabIndex = 1;
  			// 
  			// label1
  			// 
  			this.label1.Location = new System.Drawing.Point(24, 80);
  			this.label1.Name = "label1";
  			this.label1.Size = new System.Drawing.Size(104, 16);
  			this.label1.TabIndex = 0;
  			this.label1.Text = "Last Name";
  			this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
  			// 
  			// label2
  			// 
  			this.label2.Location = new System.Drawing.Point(24, 106);
  			this.label2.Name = "label2";
  			this.label2.Size = new System.Drawing.Size(104, 16);
  			this.label2.TabIndex = 0;
  			this.label2.Text = "First Name";
  			this.label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
  			// 
  			// textFName
  			// 
  			this.textFName.Location = new System.Drawing.Point(129, 104);
  			this.textFName.Name = "textFName";
  			this.textFName.Size = new System.Drawing.Size(297, 20);
  			this.textFName.TabIndex = 2;
  			// 
  			// label3
  			// 
  			this.label3.Location = new System.Drawing.Point(24, 132);
  			this.label3.Name = "label3";
  			this.label3.Size = new System.Drawing.Size(104, 16);
  			this.label3.TabIndex = 0;
  			this.label3.Text = "Middle Name";
  			this.label3.TextAlign = System.Drawing.ContentAlignment.TopRight;
  			// 
  			// textMName
  			// 
  			this.textMName.Location = new System.Drawing.Point(129, 130);
  			this.textMName.Name = "textMName";
  			this.textMName.Size = new System.Drawing.Size(169, 20);
  			this.textMName.TabIndex = 3;
  			// 
  			// label4
  			// 
  			this.label4.Location = new System.Drawing.Point(24, 262);
  			this.label4.Name = "label4";
  			this.label4.Size = new System.Drawing.Size(104, 16);
  			this.label4.TabIndex = 0;
  			this.label4.Text = "ST";
  			this.label4.TextAlign = System.Drawing.ContentAlignment.TopRight;
  			// 
  			// textST
  			// 
  			this.textST.Location = new System.Drawing.Point(129, 260);
  			this.textST.Name = "textST";
  			this.textST.Size = new System.Drawing.Size(118, 20);
  			this.textST.TabIndex = 8;
  			// 
  			// groupSSN
  			// 
  			this.groupSSN.Controls.Add(this.radioTIN);
  			this.groupSSN.Controls.Add(this.radioSSN);
  			this.groupSSN.Controls.Add(this.textSSN);
  			this.groupSSN.FlatStyle = System.Windows.Forms.FlatStyle.System;
  			this.groupSSN.Location = new System.Drawing.Point(121, 409);
  			this.groupSSN.Name = "groupSSN";
  			this.groupSSN.Size = new System.Drawing.Size(141, 80);
  			this.groupSSN.TabIndex = 0;
  			this.groupSSN.TabStop = false;
  			this.groupSSN.Text = "SSN or TIN (no dashes)";
  			// 
  			// radioTIN
  			// 
  			this.radioTIN.FlatStyle = System.Windows.Forms.FlatStyle.System;
  			this.radioTIN.Location = new System.Drawing.Point(9, 34);
  			this.radioTIN.Name = "radioTIN";
  			this.radioTIN.Size = new System.Drawing.Size(104, 16);
  			this.radioTIN.TabIndex = 18;
  			this.radioTIN.Text = "TIN";
  			this.radioTIN.Click += new System.EventHandler(this.radioTIN_Click);
  			// 
  			// radioSSN
  			// 
  			this.radioSSN.Checked = true;
  			this.radioSSN.FlatStyle = System.Windows.Forms.FlatStyle.System;
  			this.radioSSN.Location = new System.Drawing.Point(9, 17);
  			this.radioSSN.Name = "radioSSN";
  			this.radioSSN.Size = new System.Drawing.Size(104, 14);
  			this.radioSSN.TabIndex = 17;
  			this.radioSSN.TabStop = true;
  			this.radioSSN.Text = "SSN";
  			this.radioSSN.Click += new System.EventHandler(this.radioSSN_Click);
  			// 
  			// textSSN
  			// 
  			this.textSSN.Location = new System.Drawing.Point(8, 54);
  			this.textSSN.Name = "textSSN";
  			this.textSSN.Size = new System.Drawing.Size(100, 20);
  			this.textSSN.TabIndex = 15;
  			// 
  			// listSpecialty
  			// 
  			this.listSpecialty.Items.AddRange(new object[] {
              "Dental General Practice",
              "Dental Hygienist",
              "Endodontics",
              "Pediatric Dentistry",
              "Periodontics",
              "Prosthodontics",
              "Orthodontics",
              "Denturist",
              "Surgery, Oral & Maxillofacial",
              "Dental Assistant",
              "Dental Laboratory Technician",
              "Pathology, Oral & MaxFac",
              "Public Health",
              "Radiology"});
  			this.listSpecialty.Location = new System.Drawing.Point(501, 98);
  			this.listSpecialty.Name = "listSpecialty";
  			this.listSpecialty.Size = new System.Drawing.Size(154, 186);
  			this.listSpecialty.TabIndex = 0;
  			this.listSpecialty.TabStop = false;
  			// 
  			// label10
  			// 
  			this.label10.Location = new System.Drawing.Point(499, 78);
  			this.label10.Name = "label10";
  			this.label10.Size = new System.Drawing.Size(99, 16);
  			this.label10.TabIndex = 0;
  			this.label10.Text = "Specialty";
  			this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  			// 
  			// textPhone3
  			// 
  			this.textPhone3.Location = new System.Drawing.Point(210, 312);
  			this.textPhone3.MaxLength = 4;
  			this.textPhone3.Name = "textPhone3";
  			this.textPhone3.Size = new System.Drawing.Size(39, 20);
  			this.textPhone3.TabIndex = 12;
  			// 
  			// label13
  			// 
  			this.label13.Location = new System.Drawing.Point(200, 314);
  			this.label13.Name = "label13";
  			this.label13.Size = new System.Drawing.Size(6, 16);
  			this.label13.TabIndex = 0;
  			this.label13.Text = "-";
  			this.label13.TextAlign = System.Drawing.ContentAlignment.TopCenter;
  			// 
  			// textPhone2
  			// 
  			this.textPhone2.Location = new System.Drawing.Point(170, 312);
  			this.textPhone2.MaxLength = 3;
  			this.textPhone2.Name = "textPhone2";
  			this.textPhone2.Size = new System.Drawing.Size(28, 20);
  			this.textPhone2.TabIndex = 11;
  			// 
  			// label11
  			// 
  			this.label11.Location = new System.Drawing.Point(158, 314);
  			this.label11.Name = "label11";
  			this.label11.Size = new System.Drawing.Size(6, 16);
  			this.label11.TabIndex = 0;
  			this.label11.Text = ")";
  			this.label11.TextAlign = System.Drawing.ContentAlignment.TopCenter;
  			// 
  			// label12
  			// 
  			this.label12.Location = new System.Drawing.Point(119, 314);
  			this.label12.Name = "label12";
  			this.label12.Size = new System.Drawing.Size(11, 16);
  			this.label12.TabIndex = 0;
  			this.label12.Text = "(";
  			this.label12.TextAlign = System.Drawing.ContentAlignment.TopRight;
  			// 
  			// textPhone1
  			// 
  			this.textPhone1.Location = new System.Drawing.Point(129, 312);
  			this.textPhone1.MaxLength = 3;
  			this.textPhone1.Name = "textPhone1";
  			this.textPhone1.Size = new System.Drawing.Size(28, 20);
  			this.textPhone1.TabIndex = 10;
  			// 
  			// label14
  			// 
  			this.label14.Location = new System.Drawing.Point(24, 314);
  			this.label14.Name = "label14";
  			this.label14.Size = new System.Drawing.Size(95, 16);
  			this.label14.TabIndex = 0;
  			this.label14.Text = "Phone";
  			this.label14.TextAlign = System.Drawing.ContentAlignment.TopRight;
  			// 
  			// textTitle
  			// 
  			this.textTitle.Location = new System.Drawing.Point(129, 156);
  			this.textTitle.MaxLength = 100;
  			this.textTitle.Name = "textTitle";
  			this.textTitle.Size = new System.Drawing.Size(70, 20);
  			this.textTitle.TabIndex = 4;
  			// 
  			// label5
  			// 
  			this.label5.Location = new System.Drawing.Point(40, 158);
  			this.label5.Name = "label5";
  			this.label5.Size = new System.Drawing.Size(89, 16);
  			this.label5.TabIndex = 0;
  			this.label5.Text = "Title (DDS)";
  			this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
  			// 
  			// textEmail
  			// 
  			this.textEmail.Location = new System.Drawing.Point(129, 366);
  			this.textEmail.MaxLength = 100;
  			this.textEmail.Name = "textEmail";
  			this.textEmail.Size = new System.Drawing.Size(297, 20);
  			this.textEmail.TabIndex = 14;
  			// 
  			// textOtherPhone
  			// 
  			this.textOtherPhone.Location = new System.Drawing.Point(129, 339);
  			this.textOtherPhone.MaxLength = 30;
  			this.textOtherPhone.Name = "textOtherPhone";
  			this.textOtherPhone.Size = new System.Drawing.Size(161, 20);
  			this.textOtherPhone.TabIndex = 13;
  			this.textOtherPhone.TextChanged += new System.EventHandler(this.textOtherPhone_TextChanged);
  			// 
  			// textZip
  			// 
  			this.textZip.Location = new System.Drawing.Point(129, 286);
  			this.textZip.MaxLength = 10;
  			this.textZip.Name = "textZip";
  			this.textZip.Size = new System.Drawing.Size(161, 20);
  			this.textZip.TabIndex = 9;
  			// 
  			// textCity
  			// 
  			this.textCity.Location = new System.Drawing.Point(129, 234);
  			this.textCity.MaxLength = 50;
  			this.textCity.Name = "textCity";
  			this.textCity.Size = new System.Drawing.Size(190, 20);
  			this.textCity.TabIndex = 7;
  			// 
  			// textAddress2
  			// 
  
gt: 			this.textAddress2.Location = new System.Drawing.Point(129, 208);