///<summary>If an appt is already on the pinboard, and the information in it is change externally, this 'refreshes' the data.</summary> public void ResetData(long aptNum) { ContrApptSingle ctrl = apptList.FirstOrDefault(x => x.AptNum == aptNum); if (ctrl == null) { return; } DataTable tableAppts = Appointments.RefreshOneApt(aptNum, false).Tables["Appointments"]; DataRow row = tableAppts.Rows[0]; if (row["AptStatus"].ToString() == "6") //planned so do it again the right way { tableAppts = Appointments.RefreshOneApt(aptNum, true).Tables["Appointments"]; row = tableAppts.Rows[0]; } //The appt fields are not in DS.Tables["ApptFields"] since the appt is not visible on the schedule. DataTable tableApptFields = Appointments.GetApptFields(tableAppts); ctrl.ResetData(row , tableApptFields , Appointments.GetPatFields(tableAppts.Select().Select(x => PIn.Long(x["PatNum"].ToString())).ToList()) , ctrl.Location , false); ctrl.Width = this.Width - 2; Invalidate(); }
///<Summary>If adding a family, this will be called repeatedly.</Summary> public void AddAppointment(Bitmap bitmap, long aptNum, DataRow dataRow) { for (int i = 0; i < ListPinBoardItems.Count; i++) { if (ListPinBoardItems[i].AptNum == aptNum) { //The appointment being passed in is already on the pinboard. //Remove the old one so that we can replace it with the new one. //This happens when the appointment changes provider, for example. ListPinBoardItems[i].BitmapAppt.Dispose(); ListPinBoardItems.RemoveAt(i); break; } } PinBoardItem pinBoardItem = new PinBoardItem(); pinBoardItem.AptNum = aptNum; pinBoardItem.BitmapAppt = new Bitmap(bitmap); //so that we can dispose of the one that was passed in pinBoardItem.DataRowAppt = dataRow; List <long> listAptNums = new List <long>() { aptNum }; pinBoardItem.TableApptFields = Appointments.GetApptFieldsByApptNums(listAptNums); List <long> listPatNums = new List <long>() { PIn.Long(dataRow["PatNum"].ToString()) }; pinBoardItem.TablePatFields = Appointments.GetPatFields(listPatNums); ListPinBoardItems.Add(pinBoardItem); _selectedIndex = ListPinBoardItems.Count - 1; Invalidate(); }
///<Summary>Supply an aptNum to get the corresponding DataRow and DataTables necessary to create the ContrApptSingle. Calls directly to database.</Summary> public ContrApptSingle AddAppointment(long aptNum) { DataTable tableAppts = Appointments.RefreshOneApt(aptNum, false).Tables["Appointments"]; DataRow row = tableAppts.Rows[0]; if (row["AptStatus"].ToString() == "6") //planned so do it again the right way { tableAppts = Appointments.RefreshOneApt(aptNum, true).Tables["Appointments"]; row = tableAppts.Rows[0]; } //The appt fields are not in DS.Tables["ApptFields"] since the appt is not visible on the schedule. DataTable tableApptFields = Appointments.GetApptFields(tableAppts); return(AddAppointment(row, tableApptFields, Appointments.GetPatFields(tableAppts.Select().Select(x => PIn.Long(x["PatNum"].ToString())).ToList()))); }