private void FormApptTypeEdit_Load(object sender, EventArgs e) { textName.Text = AppointmentTypeCur.AppointmentTypeName; butColor.BackColor = AppointmentTypeCur.AppointmentTypeColor; checkIsHidden.Checked = AppointmentTypeCur.IsHidden; _listProcCodes = ProcedureCodes.GetFromCommaDelimitedList(AppointmentTypeCur.CodeStr); _provColor = Color.Blue; _strBTime = new StringBuilder(); if (AppointmentTypeCur.Pattern != null) //logic copied from FormApptEdit { _strBTime = new StringBuilder(Appointments.ConvertPatternFrom5(AppointmentTypeCur.Pattern)); } FillTime(); RefreshListBoxProcCodes(); }
private void FillGridWSNPAReasons() { List <Def> listDefs = Defs.GetDefsForCategory(DefCat.WebSchedNewPatApptTypes, true); List <DefLink> listDefLinks = DefLinks.GetDefLinksByType(DefLinkType.AppointmentType); List <AppointmentType> listApptTypes = AppointmentTypes.GetWhere(x => listDefLinks.Any(y => y.FKey == x.AppointmentTypeNum), true); //The combo box within the available times group box should always reflect the grid. comboWSNPADefApptType.Items.Clear(); gridWSNPAReasons.BeginUpdate(); gridWSNPAReasons.ListGridColumns.Clear(); gridWSNPAReasons.ListGridColumns.Add(new GridColumn(Lan.g(this, "Reason"), 120)); gridWSNPAReasons.ListGridColumns.Add(new GridColumn(Lan.g(this, "Pattern"), 0)); gridWSNPAReasons.ListGridRows.Clear(); GridRow row; foreach (Def def in listDefs) { AppointmentType apptType = null; DefLink defLink = listDefLinks.FirstOrDefault(x => x.DefNum == def.DefNum); if (defLink == null) { continue; //Corruption? } apptType = listApptTypes.FirstOrDefault(x => x.AppointmentTypeNum == defLink.FKey); if (apptType == null) { continue; //Corruption? } row = new GridRow(); row.Cells.Add(def.ItemName); row.Cells.Add((string.IsNullOrEmpty(apptType.Pattern) ? Lan.g(this, "(use procedure time pattern)") : Appointments.ConvertPatternFrom5(apptType.Pattern))); gridWSNPAReasons.ListGridRows.Add(row); comboWSNPADefApptType.Items.Add(def.ItemName, def); } gridWSNPAReasons.EndUpdate(); if (comboWSNPADefApptType.Items.Count > 0) { comboWSNPADefApptType.SelectedIndex = 0; //Select Default. } }