private void populateIssuerType() { if (idType == null) { return; } if (identIssuer != null) { identIssuer.Enabled = true; } selectedIDType = idType.SelectedIndex > 0 ? idType.SelectedValue.ToString() : ""; switch (selectedIDType) { case "": this.tableLayoutPanel2.Controls.Remove(pwnapp_identificationstate); this.tableLayoutPanel2.Controls.Add(pwnapp_identificationcountry, 1, 1); this.pwnapp_identificationcountry.Enabled = false; pwnapp_identificationstate.Visible = false; this.pwnapp_identificationcountry.SetBounds(193, 16, pwnapp_identificationcountry.Width, pwnapp_identificationcountry.Height); break; case StateIdTypes.STATE_IDENTIFICATION_ID: this.tableLayoutPanel2.Controls.Remove(pwnapp_identificationcountry); this.tableLayoutPanel2.Controls.Add(pwnapp_identificationstate, 1, 1); pwnapp_identificationstate.TabIndex = this.pwnapp_identificationtype.TabIndex + 1; pwnapp_identificationstate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.pwnapp_identificationstate.SetBounds(193, 16, pwnapp_identificationstate.Width, pwnapp_identificationstate.Height); pwnapp_identificationstate.Visible = true; break; case StateIdTypes.DRIVERLICENSE: this.tableLayoutPanel2.Controls.Remove(pwnapp_identificationcountry); this.tableLayoutPanel2.Controls.Add(pwnapp_identificationstate, 1, 1); pwnapp_identificationstate.TabIndex = this.pwnapp_identificationtype.TabIndex + 1; pwnapp_identificationstate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.pwnapp_identificationstate.SetBounds(193, 16, pwnapp_identificationstate.Width, pwnapp_identificationstate.Height); pwnapp_identificationstate.Visible = true; break; case StateIdTypes.CONCEALED_WEAPONS_PERMIT: ////Madhu BZ # 116 this.tableLayoutPanel2.Controls.Remove(pwnapp_identificationcountry); this.tableLayoutPanel2.Controls.Add(pwnapp_identificationstate, 1, 1); pwnapp_identificationstate.TabIndex = this.pwnapp_identificationtype.TabIndex + 1; pwnapp_identificationstate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.pwnapp_identificationstate.SetBounds(193, 16, pwnapp_identificationstate.Width, pwnapp_identificationstate.Height); pwnapp_identificationstate.Visible = true; //this.tableLayoutPanel2.ColumnStyles[1].Width = 51; break; //end case StateIdTypes.MEXICAN_CONSULATE: this.tableLayoutPanel2.Controls.Remove(pwnapp_identificationstate); identIssuer = (ComboBox)this.pwnapp_identificationcountry.Controls[0]; identIssuer.SelectedIndex = identIssuer.FindString("Mexico"); populateIdNumberAndDate(); this.pwnapp_identificationcountry.isValid = true; identIssuer.Enabled = false; this.tableLayoutPanel2.Controls.Add(pwnapp_identificationcountry, 1, 1); pwnapp_identificationcountry.TabIndex = this.pwnapp_identificationtype.TabIndex + 1; pwnapp_identificationcountry.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); //this.tableLayoutPanel2.ColumnStyles[1].Width = 140; this.pwnapp_identificationcountry.Enabled = true; pwnapp_identificationstate.Visible = false; this.pwnapp_identificationcountry.SetBounds(193, 16, pwnapp_identificationcountry.Width, pwnapp_identificationcountry.Height); break; default: this.tableLayoutPanel2.Controls.Remove(pwnapp_identificationstate); this.tableLayoutPanel2.Controls.Add(pwnapp_identificationcountry, 1, 1); pwnapp_identificationcountry.TabIndex = this.pwnapp_identificationtype.TabIndex + 1; pwnapp_identificationcountry.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); //this.tableLayoutPanel2.ColumnStyles[1].Width = 140; this.pwnapp_identificationcountry.Enabled = true; pwnapp_identificationstate.Visible = false; this.pwnapp_identificationcountry.SetBounds(193, 16, pwnapp_identificationcountry.Width, pwnapp_identificationcountry.Height); break; } if (this.tableLayoutPanel2.Controls.Contains(pwnapp_identificationstate)) { pwnapp_identificationstate.TabIndex = this.pwnapp_identificationtype.TabIndex + 1; identIssuer = (ComboBox)this.pwnapp_identificationstate.Controls[0]; foreach (USState custidissuer in identIssuer.Items) { custidissuer.Selected = false; } if (newCustomer != null) { List <IdentificationVO> custIdTypes = newCustomer.getIdentifications(selectedIDType); bool primarySelected = false; if (custIdTypes != null && custIdTypes.Count > 0) { foreach (IdentificationVO id in custIdTypes) { if (id.IdIssuerCode.Trim().Length != 0) { foreach (USState custidissuer in identIssuer.Items) { if (custidissuer.ShortName == id.IdIssuerCode) { custidissuer.Selected = true; if (id.IsLatest) { identIssuer.SelectedIndex = identIssuer.FindString(custidissuer.ShortName); pwnapp_identificationnumber.Enabled = false; pwnapp_identificationnumber.Text = id.IdValue; this.pwnapp_identificationexpirationdate.Enabled = false; if (id.IdExpiryData.FormatDate() != string.Empty && (id.IdExpiryData.Date != DateTime.MaxValue.Date)) { this.pwnapp_identificationexpirationdate.Controls[0].Text = (id.IdExpiryData).FormatDate(); } primarySelected = true; break; } if (!primarySelected) { resetValues(); } } } } } } } } else { pwnapp_identificationcountry.TabIndex = this.pwnapp_identificationtype.TabIndex + 1; if (newCustomer != null) { identIssuer = (ComboBox)this.pwnapp_identificationcountry.Controls[0]; List <IdentificationVO> custIdTypes = newCustomer.getIdentifications(selectedIDType); foreach (CountryData custidissuer in custIdCountry.Items) { custidissuer.Selected = false; } bool primarySelected = false; if (custIdTypes != null && custIdTypes.Count > 0) { foreach (IdentificationVO id in custIdTypes) { if (id.IdIssuerCode.Trim().Length != 0) { foreach (CountryData custidissuer in custIdCountry.Items) { if (custidissuer.Code == id.IdIssuerCode) { custidissuer.Selected = true; if (id.IsLatest) { identIssuer.SelectedIndex = identIssuer.FindString(custidissuer.Name); pwnapp_identificationnumber.Enabled = false; this.pwnapp_identificationexpirationdate.Enabled = false; pwnapp_identificationnumber.Text = id.IdValue; if (id.IdExpiryData.FormatDate() != string.Empty && (id.IdExpiryData.Date != DateTime.MaxValue.Date)) { this.pwnapp_identificationexpirationdate.Controls[0].Text = (id.IdExpiryData).FormatDate(); } primarySelected = true; break; } if (!primarySelected) { resetValues(); } } } } } } } } }