Changeset 1111 for Scheduling/trunk/cs/bsdx0200GUISourceCode/DCheckIn.cs
- Timestamp:
- Mar 23, 2011, 5:15:51 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/DCheckIn.cs
r1062 r1111 7 7 using System.Diagnostics; 8 8 using IndianHealthService.BMXNet; 9 using System.Collections.Generic; 10 using System.Linq; 9 11 10 12 namespace IndianHealthService.ClinicalScheduling … … 23 25 // 24 26 InitializeComponent(); 25 26 //27 // TODO: Add any constructor code after InitializeComponent call28 //29 27 } 30 28 … … 59 57 private DataView m_dvClinic; 60 58 private DataView m_dvForm; 61 private bool m_bInit;62 59 public bool m_bPrintRouteSlip; 60 private List<Provider> _providers; 63 61 private ToolTip toolTip1; 64 62 … … 68 66 69 67 /// <summary> 70 /// Returns string representation of internal entry number of Provider in PROVIDER File71 /// </summary> 72 public string ProviderIEN68 /// Returns Provider chosen for Check-In 69 /// </summary> 70 public Provider Provider 73 71 { 74 72 get 75 73 { 76 return this.m_sProviderIEN; 74 if (cboProvider.SelectedIndex < 1) return null; // because first item is empty placeholder 75 else return this._providers[cboProvider.SelectedIndex]; 77 76 } 78 77 } … … 113 112 /// <param name="a">Appointment</param> 114 113 /// <param name="docManager">Document Manager</param> 115 /// <param name="sDefaultProvider">Default provider</param> 116 public void InitializePage(CGAppointment a, CGDocumentManager docManager, 117 string sDefaultProvider, int nHospLoc) 118 { 119 m_bInit = true; 120 m_DocManager = docManager; 114 public void InitializePage(CGAppointment a) 115 { 116 m_DocManager = CGDocumentManager.Current; 121 117 m_dsGlobal = m_DocManager.GlobalDataSet; 122 int nFind = 0; 118 119 Int32? nHospLoc = (from resource in m_dsGlobal.Tables["Resources"].AsEnumerable() 120 where resource.Field<string>("RESOURCE_NAME") == a.Resource 121 select resource.Field<Int32?>("HOSPITAL_LOCATION_ID")) 122 .SingleOrDefault(); 123 124 //smh - following logic replaced with above... 125 /* 126 DataView rv = new DataView(this.m_DocManager.GlobalDataSet.Tables["Resources"]); 127 rv.Sort = "RESOURCE_NAME ASC"; 128 int nFind = rv.Find((string)a.Resource); 129 DataRowView drv = rv[nFind]; 130 131 string sHospLoc = drv["HOSPITAL_LOCATION_ID"].ToString(); 132 sHospLoc = (sHospLoc == "") ? "0" : sHospLoc; 133 int nHospLoc = 0; 134 try 135 { 136 nHospLoc = Convert.ToInt32(sHospLoc); 137 } 138 catch (Exception ex) 139 { 140 Debug.Write("CGView.AppointmentCheckIn Error: " + ex.Message); 141 } 142 */ 123 143 124 144 //smh new code 125 145 //if the resource is linked to a valid hospital location, grab this locations providers 126 146 //from the provider multiple and put them in the combo box. 127 if (nHospLoc != 0)147 if (nHospLoc != null) 128 148 { 129 149 //RPC BSDX HOSP LOC PROVIDERS returns Table w/ Columns: 130 150 //HOSPITAL_LOCATION_ID^BMXIEN (ie Prov IEN)^NAME^DEFALUT 131 151 string sCommandText = "BSDX HOSP LOC PROVIDERS^" + nHospLoc; 132 m_dtProvider = docManager.RPMSDataTable(sCommandText, "ClinicProviders"); 133 m_dtProvider.DefaultView.Sort = "NAME ASC"; 134 135 cboProvider.DataSource = m_dtProvider; 136 cboProvider.DisplayMember = "NAME"; 137 cboProvider.ValueMember = "BMXIEN"; 138 139 //Add None to the top of the list 140 DataRow drProv = m_dtProvider.NewRow(); 141 drProv.BeginEdit(); 142 drProv["HOSPITAL_LOCATION_ID"] = 0; 143 drProv["NAME"] = "<None>"; 144 drProv["BMXIEN"] = 0; 145 drProv.EndEdit(); 146 m_dtProvider.Rows.InsertAt(drProv, 0); 147 cboProvider.SelectedIndex = 0; 152 m_dtProvider = m_DocManager.RPMSDataTable(sCommandText, "ClinicProviders"); 153 154 _providers = (from providerRow in m_dtProvider.AsEnumerable() 155 orderby providerRow.Field<string>("NAME") 156 select new Provider 157 { 158 IEN = providerRow.Field<int>("BMXIEN"), 159 Name = providerRow.Field<string>("NAME"), 160 Default = providerRow.Field<string>("DEFAULT") == "YES" ? true : false 161 }).ToList(); 162 163 164 165 //cboProvider.DisplayMember = "NAME"; 166 //cboProvider.ValueMember = "BMXIEN"; 167 _providers.Insert(0, new Provider { Name = "<None>", IEN = -1 }); 168 cboProvider.DataSource = _providers; 169 cboProvider.SelectedIndex = _providers.FindIndex(prov => prov.Default); 170 // if no provider is default, set default to be <none> item. 171 if (cboProvider.SelectedIndex == -1) cboProvider.SelectedIndex = 0; 172 ////Add None to the top of the list 173 //DataRow drProv = m_dtProvider.NewRow(); 174 //drProv.BeginEdit(); 175 //drProv["HOSPITAL_LOCATION_ID"] = 0; 176 //drProv["NAME"] = "<None>"; 177 //drProv["BMXIEN"] = 0; 178 //drProv.EndEdit(); 179 //m_dtProvider.Rows.InsertAt(drProv, 0); 180 ////cboProvider.SelectedIndex = 0; 148 181 149 182 //Find default provider--search for Yes in Field DEFAULT 150 DataRow[] nRow = m_dtProvider.Select("DEFAULT='YES'", "NAME ASC");151 if (nRow.Length > 0) nFind = m_dtProvider.Rows.IndexOf(nRow[0]);152 cboProvider.SelectedIndex = nFind;183 //DataRow[] nRow = m_dtProvider.Select("DEFAULT='YES'", "NAME ASC"); 184 //if (nRow.Length > 0) nFind = m_dtProvider.Rows.IndexOf(nRow[0]); 185 153 186 154 187 } … … 156 189 else 157 190 { 158 m_dtProvider = m_dsGlobal.Tables["Provider"]; 159 m_dtProvider.DefaultView.Sort = "NAME ASC"; 160 161 cboProvider.DataSource = m_dtProvider; 162 cboProvider.DisplayMember = "NAME"; 163 cboProvider.ValueMember = "BMXIEN"; 191 192 _providers = (from providerRow in m_dsGlobal.Tables["Provider"].AsEnumerable() 193 orderby providerRow.Field<string>("NAME") 194 select new Provider 195 { 196 IEN = providerRow.Field<int>("BMXIEN"), 197 Name = providerRow.Field<string>("NAME"), 198 Default = false 199 }).ToList(); 200 201 202 /*m_dtProvider = m_dsGlobal.Tables["Provider"]; 203 m_dtProvider.DefaultView.Sort = "NAME ASC";*/ 204 _providers.Insert(0, new Provider { Name = "<None>", IEN = -1 }); 205 cboProvider.DataSource = _providers; 206 cboProvider.SelectedIndex = 0; 207 //cboProvider.DisplayMember = "NAME"; 208 //cboProvider.ValueMember = "BMXIEN"; 164 209 165 210 //Add None to the top of the list 166 DataRow drProv = m_dtProvider.NewRow(); 167 drProv.BeginEdit(); 168 drProv["NAME"] = "<None>"; 169 drProv["BMXIEN"] = 0; 170 drProv.EndEdit(); 171 m_dtProvider.Rows.InsertAt(drProv, 0); 172 cboProvider.SelectedIndex = 0; 173 } 174 211 //DataRow drProv = m_dtProvider.NewRow(); 212 //drProv.BeginEdit(); 213 //drProv["NAME"] = "<None>"; 214 //drProv["BMXIEN"] = 0; 215 //drProv.EndEdit(); 216 //m_dtProvider.Rows.InsertAt(drProv, 0); 217 //cboProvider.SelectedIndex = 0; 218 } 219 220 175 221 176 222 m_sPatientName = a.PatientName; … … 187 233 } 188 234 235 //Print Routing Slip based on user preferences. 236 chkRoutingSlip.Checked = CGDocumentManager.Current.UserPreferences.PrintRoutingSlipAutomatically; 237 189 238 UpdateDialogData(true); 190 m_bInit = false;191 239 } 192 240 … … 363 411 // cboProvider 364 412 // 413 this.cboProvider.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 365 414 this.cboProvider.Location = new System.Drawing.Point(96, 88); 366 415 this.cboProvider.Name = "cboProvider"; … … 384 433 this.chkRoutingSlip.Text = "Print Routing Slip"; 385 434 this.toolTip1.SetToolTip(this.chkRoutingSlip, "Prints routing slip to the Windows Default Printer"); 435 this.chkRoutingSlip.CheckedChanged += new System.EventHandler(this.chkRoutingSlip_CheckedChanged); 386 436 // 387 437 // DCheckIn … … 418 468 } 419 469 470 /// <summary> 471 /// Save this in User Preferences Object. 472 /// </summary> 473 /// <param name="sender"></param> 474 /// <param name="e"></param> 475 private void chkRoutingSlip_CheckedChanged(object sender, EventArgs e) 476 { 477 CGDocumentManager.Current.UserPreferences.PrintRoutingSlipAutomatically = chkRoutingSlip.Checked; 478 } 479 420 480 #endregion Events 481 421 482 } 422 483 }
Note:
See TracChangeset
for help on using the changeset viewer.