示例#1
0
 private void FormDiscountPlanEdit_Load(object sender, EventArgs e)
 {
     textDescript.Text = DiscountPlanCur.Description;
     _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
     _countPats           = DiscountPlans.GetPatCountForPlan(DiscountPlanCur.DiscountPlanNum);
     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
     {
         _listPatNames = DiscountPlans.GetPatNamesForPlan(DiscountPlanCur.DiscountPlanNum)
                         .Distinct()
                         .OrderBy(x => x)
                         .ToList();
         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;
     }
 }
示例#2
0
        private void butListPatients_Click(object sender, EventArgs e)
        {
            if (_listPatNames == null)
            {
                _listPatNames = DiscountPlans.GetPatNamesForPlan(DiscountPlanCur.DiscountPlanNum)
                                .Distinct()
                                .OrderBy(x => x)
                                .ToList();
            }
            ODForm form = new ODForm()
            {
                Size            = new Size(500, 400),
                Text            = "Other Patients List",
                FormBorderStyle = FormBorderStyle.FixedSingle
            };
            ODGrid grid = new ODGrid()
            {
                Size            = new Size(475, 300),
                Location        = new Point(5, 5),
                Title           = "Patients",
                TranslationName = ""
            };

            UI.Button butClose = new UI.Button()
            {
                Size     = new Size(75, 23),
                Text     = "Close",
                Location = new Point(form.ClientSize.Width - 80, form.ClientSize.Height - 28), //Subtract the button's size plus 5 pixel buffer.
            };
            butClose.Click += (s, ex) => form.Close();                                         //When butClose is pressed, simply close the form.  If more functionality is needed, make a method below.
            form.Controls.Add(grid);
            form.Controls.Add(butClose);
            grid.BeginUpdate();
            grid.ListGridColumns.Clear();
            grid.ListGridColumns.Add(new GridColumn(Lan.g(this, "Name"), 0));
            grid.ListGridRows.Clear();
            foreach (string patName in _listPatNames)
            {
                grid.ListGridRows.Add(new GridRow(patName));
            }
            grid.EndUpdate();
            form.ShowDialog();
        }