private void FormDiscountPlanEdit_Load(object sender, EventArgs e) { textDescript.Text = DiscountPlanCur.Description; _listPatNames = DiscountPlans.GetPatsForPlan(DiscountPlanCur.DiscountPlanNum) .Select(x => x.LName + ", " + x.FName) .Distinct() .OrderBy(x => x) .ToList(); _feeSchedCur = FeeScheds.GetFirstOrDefault(x => x.FeeSchedNum == DiscountPlanCur.FeeSchedNum, true); textFeeSched.Text = _feeSchedCur != null ? _feeSchedCur.Description : ""; _listAdjTypeDefs = Defs.GetDiscountPlanAdjTypes().ToList(); for (int i = 0; i < _listAdjTypeDefs.Count; i++) { comboBoxAdjType.Items.Add(_listAdjTypeDefs[i].ItemName); if (_listAdjTypeDefs[i].DefNum == DiscountPlanCur.DefNum) { comboBoxAdjType.SelectedIndex = i; } } //populate patient information int countPats = _listPatNames.Count; textNumPatients.Text = countPats.ToString(); if (countPats > 10000) //10,000 per Nathan. copied from FormInsPlan.cs { comboPatient.Visible = false; butListPatients.Visible = true; butListPatients.Location = comboPatient.Location; } else { comboPatient.Visible = true; butListPatients.Visible = false; comboPatient.Items.Clear(); comboPatient.Items.AddRange(_listPatNames.ToArray()); if (_listPatNames.Count > 0) { comboPatient.SelectedIndex = 0; } } checkHidden.Checked = DiscountPlanCur.IsHidden; if (!Security.IsAuthorized(Permissions.InsPlanEdit, true)) //User may be able to get here if FormDiscountPlans is not in selection mode. { textDescript.ReadOnly = true; comboBoxAdjType.Enabled = false; butFeeSched.Enabled = false; butOK.Enabled = false; checkHidden.Enabled = false; } if (IsSelectionMode) { butDrop.Visible = true; } }