public EF_Identification(byte[] value, short cardType) { this.cardType = cardType; cardIdentification = new CardIdentification(HexBytes.arrayCopy(value, 0, 65), cardType); if (EquipmentType.COMPANY_CARD == cardType) { companyCardHolderIdentification = new CompanyCardHolderIdentification(HexBytes.arrayCopy(value, 65, value.Length - 65)); structureSize = CompanyCardHolderIdentification.structureSize; } else if (EquipmentType.CONTROL_CARD == cardType) { controlCardHolderIdentification = new ControlCardHolderIdentification(HexBytes.arrayCopy(value, 65, value.Length - 65)); structureSize = ControlCardApplicationIdentification.structureSize; } else if (EquipmentType.DRIVER_CARD == cardType) { driverCardHolderIdentification = new DriverCardHolderIdentification(HexBytes.arrayCopy(value, 65, 78)); structureSize = DriverCardHolderIdentification.structureSize; } else if (EquipmentType.WORKSHOP_CARD == cardType) { workshopCardHolderIdentification = new WorkshopCardHolderIdentification(HexBytes.arrayCopy(value, 65, value.Length - 65)); structureSize = WorkshopCardHolderIdentification.structureSize; } else { //Error!!! } }
protected void Driver_Identification(object sender, EventArgs e) { EnableAllDriversPreviewButtons(); CardIdentification_btn.Enabled = false; FilesPreviewPanel.Visible = true; int userID = 0; int dataBlockId = Convert.ToInt32(onlyForInternal.Value); string connectionString = ConfigurationSettings.AppSettings["fleetnetbaseConnectionString"]; DataBlock dataBlock = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]); dataBlock.OpenConnection(); TextBoxTest.Text = ""; try { DDDClass.CardIdentification data = new DDDClass.CardIdentification(); data = dataBlock.cardUnitInfo.Get_EF_Identification_CardIdentification(dataBlockId); /* TextBoxTest.Text += "card Identification: " + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardExpiryDate: " + data.cardExpiryDate.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardIssueDate: " + data.cardIssueDate.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardIssuingAuthorityName: " + data.cardIssuingAuthorityName.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardIssuingMemberState: " + data.cardIssuingMemberState.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardValidityBegin: " + data.cardValidityBegin.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardNumber: " + Environment.NewLine + "<br/>"; TextBoxTest.Text += " driverIdentificationNumber: " + data.cardNumber.driverIdentificationNumber() + Environment.NewLine + "<br/>"; TextBoxTest.Text += " ownerIdentificationNumber: " + data.cardNumber.ownerIdentificationNumber() + Environment.NewLine + "<br/>"; TextBoxTest.Text += Environment.NewLine + "<br/>"; */ DDDClass.EquipmentType cardType = dataBlock.cardUnitInfo.Get_EF_Identification_CardType(dataBlockId); switch (cardType.equipmentType) { case 1: { DDDClass.DriverCardHolderIdentification driverCard = new DDDClass.DriverCardHolderIdentification(); driverCard = dataBlock.cardUnitInfo.Get_EF_Identification_DriverCardHolderIdentification(dataBlockId); /* TextBoxTest.Text += "cardType: " + cardType.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardHolderBirthDate: " + driverCard.cardHolderBirthDate.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardHolderName: " + driverCard.cardHolderName.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardHolderName: " + driverCard.cardHolderPreferredLanguage.ToString() + Environment.NewLine + "<br/>";*/ FilesPreviewDataGrid.DataSource = DriverPreviewDataTable.DriverPreview_CardIdentification(data, driverCard, cardType); FilesPreviewDataGrid.DataBind(); } break; case 2: { DDDClass.WorkshopCardHolderIdentification workshopCard = new DDDClass.WorkshopCardHolderIdentification(); workshopCard = dataBlock.cardUnitInfo.Get_EF_Identification_WorkshopCardHolderIdentification(dataBlockId); /* TextBoxTest.Text += "cardType: " + cardType.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "workshopName: " + workshopCard.workshopName.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "workshopAddress: " + workshopCard.workshopAddress.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardHolderName: " + workshopCard.cardHolderName.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardHolderPreferredLanguage: " + workshopCard.cardHolderPreferredLanguage.ToString() + Environment.NewLine + "<br/>";*/ FilesPreviewDataGrid.DataSource = DriverPreviewDataTable.DriverPreview_CardIdentification(data, workshopCard, cardType); FilesPreviewDataGrid.DataBind(); } break; case 3: { DDDClass.ControlCardHolderIdentification controlCard = new DDDClass.ControlCardHolderIdentification(); controlCard = dataBlock.cardUnitInfo.Get_EF_Identification_ControlCardHolderIdentification(dataBlockId); TextBoxTest.Text += "cardType: " + cardType.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardHolderName: " + controlCard.cardHolderName.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardHolderPreferredLanguage: " + controlCard.cardHolderPreferredLanguage.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "controlBodyAddress: " + controlCard.controlBodyAddress.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "controlBodyName: " + controlCard.controlBodyName.ToString() + Environment.NewLine + "<br/>"; } break; case 4: { DDDClass.CompanyCardHolderIdentification companyCard = new DDDClass.CompanyCardHolderIdentification(); companyCard = dataBlock.cardUnitInfo.Get_EF_Identification_CompanyCardHolderIdentification(dataBlockId); TextBoxTest.Text += "cardType: " + cardType.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "cardHolderPreferredLanguage: " + companyCard.cardHolderPreferredLanguage.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "companyAddress: " + companyCard.companyAddress.ToString() + Environment.NewLine + "<br/>"; TextBoxTest.Text += "companyName: " + companyCard.companyName.ToString() + Environment.NewLine + "<br/>"; } break; default: throw new Exception("Неизвестный тип карты!"); } } catch (Exception exc) { TextBoxTest.Text = ""; TextBoxTest.Visible = false; Status.Text = exc.Message; StatusUpdatePanel.Update(); } finally { dataBlock.CloseConnection(); ModalPopupExtender1.Hide(); } }