Ejemplo n.º 1
0
        private void FillGrid()
        {
            long previousSelectedStateAbbrNum = -1;
            int  newSelectedIdx = -1;

            if (gridMain.GetSelectedIndex() != -1)
            {
                previousSelectedStateAbbrNum = ((StateAbbr)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag).StateAbbrNum;
            }
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("FormStateAbbrs", "Description"), 175);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("FormStateAbbrs", "Abbr"), 70);
            gridMain.ListGridColumns.Add(col);
            if (PrefC.GetBool(PrefName.EnforceMedicaidIDLength))
            {
                col = new GridColumn(Lan.g("FormStateAbbrs", "Medicaid ID Length"), 200);
                gridMain.ListGridColumns.Add(col);
            }
            gridMain.ListGridRows.Clear();
            GridRow          row;
            List <StateAbbr> stateAbbrs = StateAbbrs.GetDeepCopy();

            for (int i = 0; i < stateAbbrs.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(stateAbbrs[i].Description);
                row.Cells.Add(stateAbbrs[i].Abbr);
                if (PrefC.GetBool(PrefName.EnforceMedicaidIDLength))
                {
                    if (stateAbbrs[i].MedicaidIDLength == 0)
                    {
                        row.Cells.Add("");
                    }
                    else
                    {
                        row.Cells.Add(stateAbbrs[i].MedicaidIDLength.ToString());
                    }
                }
                row.Tag = stateAbbrs[i];
                gridMain.ListGridRows.Add(row);
                if (stateAbbrs[i].StateAbbrNum == previousSelectedStateAbbrNum)
                {
                    newSelectedIdx = i;
                }
            }
            gridMain.EndUpdate();
            gridMain.SetSelected(newSelectedIdx, true);
        }
Ejemplo n.º 2
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (_stateAbbrCur.IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete State Abbr?"))
     {
         return;
     }
     StateAbbrs.Delete(_stateAbbrCur.StateAbbrNum);
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 3
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textDescription.Text == "")
     {
         MsgBox.Show(this, "Description cannot be blank.");
         return;
     }
     if (textAbbr.Text == "")
     {
         MsgBox.Show(this, "Abbrevation cannot be blank.");
         return;
     }
     if (textMedIDLength.errorProvider1.GetError(textMedIDLength) != "")
     {
         MsgBox.Show(this, "Medicaid ID length is invalid.");
         return;
     }
     _stateAbbrCur.Description = textDescription.Text;
     _stateAbbrCur.Abbr        = textAbbr.Text;
     if (PrefC.GetBool(PrefName.EnforceMedicaidIDLength))
     {
         _stateAbbrCur.MedicaidIDLength = 0;
         if (textMedIDLength.Text != "")
         {
             _stateAbbrCur.MedicaidIDLength = PIn.Int(textMedIDLength.Text);
         }
     }
     if (_stateAbbrCur.IsNew)
     {
         StateAbbrs.Insert(_stateAbbrCur);
     }
     else
     {
         StateAbbrs.Update(_stateAbbrCur);
     }
     DialogResult = DialogResult.OK;
 }