예제 #1
0
        public int AddSubfile(AAMVASubfileType subfileType, string subfileTypeCode)
        {
            SubfileSkeleton subfileSkeleton = new SubfileSkeleton();

            subfileSkeleton.SubfileType     = subfileType;
            subfileSkeleton.SubfileTypeCode = subfileTypeCode;
            subfileSkeleton.DataElements    = new Dictionary <string, AAMVADataElement>();
            _subfiles.Add(subfileSkeleton);
            _textBoxNumEntries.Text = _subfiles.Count.ToString();

            SubfileRowControl subfileRow = new SubfileRowControl();

            subfileRow.ParentMainForm = this;
            subfileRow.SubfileIndex   = _subfiles.Count - 1;
            subfileRow.Jurisdiction   = ((AAMVAJurisdiction)_comboBoxJurisdiction.SelectedValue);
            subfileRow.SubfileType    = subfileType;
            subfileRow.Dock           = DockStyle.Top;
            _panelSubfiles.Controls.Add(subfileRow);
            _panelSubfiles.Controls.SetChildIndex(subfileRow, 0);
            EnableWriteButtons();
            if (subfileType == AAMVASubfileType.DL || subfileType == AAMVASubfileType.ID)
            {
                DisableJurisdiction();
            }

            //return the index
            return(_subfiles.Count - 1);
        }
예제 #2
0
 protected virtual void RaiseSubfileAddedEvent()
 {
     if (SubfileAdded != null)
     {
         AAMVASubfileType subfileType = (AAMVASubfileType)_comboBoxSubfileType.SelectedValue;
         SubfileAdded(this, new SubfileAddedEventArgs(subfileType, _textBoxCode.Text));
     }
 }
예제 #3
0
        private void _btnAddAddSubDlg_Click(object sender, EventArgs e)
        {
            AAMVASubfileType subfileType = (AAMVASubfileType)_comboBoxSubfileType.SelectedValue;

            if (subfileType != AAMVASubfileType.JurisdictionSpecific ||
                subfileType == AAMVASubfileType.JurisdictionSpecific && _textBoxCode.Text.Length == 2 && _textBoxCode.Text[0] == 'Z')
            {
                bool hasIDDL      = false;
                bool hasJurisSpec = false;
                foreach (MainForm.SubfileSkeleton existingSubfile in _parent.SubfileSkeletons)
                {
                    if (existingSubfile.SubfileType == AAMVASubfileType.DL || existingSubfile.SubfileType == AAMVASubfileType.ID)
                    {
                        hasIDDL = true;
                    }

                    if (existingSubfile.SubfileType == AAMVASubfileType.JurisdictionSpecific)
                    {
                        hasJurisSpec = true;
                    }
                }

                if ((subfileType == AAMVASubfileType.DL || subfileType == AAMVASubfileType.ID) && hasIDDL)
                {
                    MessageBox.Show("AAMVA ID can only have 1 ID/DL subfile. You must delete the existing ID/DL subfile to continue with this operation.");
                    System.Media.SystemSounds.Beep.Play();
                    return;
                }

                if (subfileType == AAMVASubfileType.JurisdictionSpecific && hasJurisSpec)
                {
                    MessageBox.Show("AAMVA ID can only have 1 jurisdiction-specific subfile. You must delete the existing jurisdiction-specific subfile to continue with this operation.");
                    System.Media.SystemSounds.Beep.Play();
                    return;
                }

                RaiseSubfileAddedEvent();
                Hide();
                Close();
            }
            else
            {
                MessageBox.Show("Invalid Subfile Type Code!");
                System.Media.SystemSounds.Beep.Play();
            }
        }
예제 #4
0
        private void _comboBoxSubfileType_SelectedValueChanged(object sender, EventArgs e)
        {
            AAMVASubfileType subfileType = (AAMVASubfileType)_comboBoxSubfileType.SelectedValue;

            switch (subfileType)
            {
            case AAMVASubfileType.DL:
                _textBoxCode.Text      = "DL";
                _textBoxCode.ReadOnly  = true;
                _textBoxCode.BackColor = SystemColors.Control;
                _checkBoxAuto.Visible  = false;
                break;

            case AAMVASubfileType.ID:
                _textBoxCode.Text      = "ID";
                _textBoxCode.ReadOnly  = true;
                _textBoxCode.BackColor = SystemColors.Control;
                _checkBoxAuto.Visible  = false;
                break;

            case AAMVASubfileType.JurisdictionSpecific:
                string abbr = AAMVAID.LookupStateAbbreviation(_jurisdiction);
                if (abbr != null)
                {
                    _textBoxCode.Text = "Z" + abbr[0];
                }
                else
                {
                    _textBoxCode.Text = "ZX";
                }

                _checkBoxAuto.Visible  = true;
                _textBoxCode.ReadOnly  = _checkBoxAuto.Checked;
                _textBoxCode.BackColor = _checkBoxAuto.Checked ? SystemColors.Control : Color.White;
                break;
            }
        }
예제 #5
0
 public SubfileAddedEventArgs(AAMVASubfileType subfileType, string subfileTypeCode)
 {
     this.SubfileType     = subfileType;
     this.SubfileTypeCode = subfileTypeCode;
 }
예제 #6
0
 public SubfileTypeDatum(string name, AAMVASubfileType subfileType)
 {
     this.Name  = name;
     this.Value = subfileType;
 }