public void GetCustomerInfo() { string cardParsed = Regex.Replace(CardNumber.ToString(), ".{4}", "$0-"); cardParsed = cardParsed.Remove(cardParsed.Length - 1); Console.WriteLine($" Name: {Name} \n Card No: {cardParsed} \n Balance: {ConvertCurrency(Balance)}\n Pin: {Pin}"); }
public IActionResult OnPost() { int CardNumLength = CardNumber.ToString().Length; int ExpDateLength = ExpDate.ToString().Length; int CVVLength = CVV.ToString().Length; DateTime da; if (CardNumLength == 16) { if (DateTime.TryParseExact(ExpDate.ToString(), "MM/yy", null, System.Globalization.DateTimeStyles.None, out da)) { Console.WriteLine("DateTime = success"); if (CVVLength != 3) { Console.WriteLine("CVV success"); } } else { Console.WriteLine("Please use the correct format"); } } else { Console.WriteLine("The Card Number must be 16 digits"); } return(RedirectToPage("/Index")); }
public bool SetWorkMode(int mode) { string cmd = string.Format("<C{0}_[M_{1}]>", CardNumber.ToString("00"), mode); string result = Client.SendRecv(cmd); if (result == string.Format("<C{0}_[M_SETOK]>", CardNumber.ToString("00"))) { return(true); } else { return(false); } }
public bool SetTxWave(int value) { string cmd = string.Format("<C{0}_[TX_W_{1}]>", CardNumber.ToString("00"), value); var result = Client.SendRecv(cmd); if (result == string.Format("<C{0}_[TX_W_SETOK]>", CardNumber.ToString("00"))) { return(true); } else { return(false); } }
public bool SetR1SwitchingPower(double value) { string cmd = string.Format("<C{0}_[R1_SP_{1:F3}]>", CardNumber.ToString("00"), value); var result = Client.SendRecv(cmd); if (result == string.Format("<C{0}_[R1_SP_SETOK]>", CardNumber.ToString("00"))) { return(true); } else { return(false); } }
public bool SetPowerOffKeepWorkMode(int value) { string cmd = string.Format("<C{0}_[WMH_{1}]>", CardNumber.ToString("00"), value); var result = Client.SendRecv(cmd); if (result == string.Format("<C{0}_[WMH_SETOK]>", CardNumber.ToString("00"))) { return(true); } else { return(false); } }
public bool SetManualBacktoAutoDelay(int value) { string cmd = string.Format("<C{0}_[R_{1}]>", CardNumber.ToString("00"), value); var result = Client.SendRecv(cmd); if (result == string.Format("<C{0}_[R_SETOK]>", CardNumber.ToString("00"))) { return(true); } else { return(false); } }
public bool SetManualSwitchChannel(int value) { string cmd = string.Format("<C{0}_[S_{1}]>", CardNumber.ToString("00"), value); var result = Client.SendRecv(cmd); if (result == string.Format("<C{0}_[S_SETOK]>", CardNumber.ToString("00"))) { return(true); } else { return(false); } }
public bool SetGainSetting(double value) { var arrNum = value.ToString("F2").Split('.'); string cmd = string.Format("<C{0}_[PGV_+{1}.{2}]>", CardNumber.ToString("00"), arrNum[0].PadLeft(2, '0'), arrNum[1]); string result = Client.SendRecv(cmd); if (result == string.Format("<C{0}_[PGV_SETOK]>", CardNumber.ToString("00"))) { return(true); } else { return(false); } }
/// <summary> /// Generate and return a token for the informed credit card /// </summary> /// <returns>A nullable ulong with the generated token</returns> private ulong?GenerateToken() { if (CardNumber > 0 && CVV > 0) { int[] digits = CardNumber.ToString().ToCharArray().Select(x => (int)Char.GetNumericValue(x)).ToArray(); if (digits.Length > 4) { digits = new List <int>(digits).GetRange(digits.Length - 4, 4).ToArray(); } for (int i = 0; i < CVV; i++) { int j, last; last = digits[^ 1];
public Answer IsCardValid() { if (!LengthIsRight(CardNumber, 16)) { if (CardNumber.ToString().Length > 16) { return(Answer.Error("Card Number is to long. It needs to be 16 in length.")); } return(Answer.Error("Card Number is to short. It needs to be 16 in length.")); } else if (!LengthIsRight(Month, 2)) { if (Month.ToString().Length > 2) { return(Answer.Error("Month is to long. It needs to be 2 in length.")); } return(Answer.Error("Month is to short. It needs to be 2 in length.")); } else if (!LengthIsRight(Year, 2)) { if (Year.ToString().Length > 2) { return(Answer.Error("Year is to long. It needs to be 2 in length.")); } return(Answer.Error("Year is to short. It needs to be 2 in length.")); } else if (!LengthIsRight(CVC, 3)) { if (CVC.ToString().Length > 3) { return(Answer.Error("CVC is to long. It needs to be 3 in length.")); } return(Answer.Error("CVC is to short. It needs to be 3 in length.")); } else { return(Answer.Complete()); } }
private CardEntity GetCard(CardNumber cardNumber) { return(AllCardQuery.FirstOrDefault(c => c.CardNumber == cardNumber.ToString())); }
/// <summary> /// 获取当前增益 /// </summary> /// <returns></returns> public string GetGain() { string cmd = string.Format("<C02_[CPGV_?]>", CardNumber.ToString("00")); return(Client.SendRecv(cmd)); }
/// <summary> /// 获取工作模式 /// </summary> /// <returns></returns> public string GetWorkMode() { string cmd = string.Format("<C{0}_[M_?]>", CardNumber.ToString("00")); return(Client.SendRecv(cmd)); }
private void GetInfoFromCard() { string street; DoClearData(); CardReader reader = engine.GetReader(); if (reader == null) { MessageBox.Show("Can not connect to the card reader"); return; } Card card = engine.GetReader().GetCard(true); if (card == null) { return; } Identity identity = card.ReadIdentity(); Address address = card.ReadAddress(); if ((identity != null) && (address != null)) { street = address.Street; street = street.Trim(); int idx = street.Length - 1; while (idx > 0) { if (street[idx] == ' ') { break; } else { --idx; } } if (idx > 1) { edtHouse.Text = street.Substring(idx + 1, street.Length - idx - 1); if (edtHouse.Text[0] == '/') { edtHouse.Text = edtHouse.Text.Substring(1); } edtStreet.Text = street.Substring(0, idx); } else { edtStreet.Text = street; } edtBirthDate.Text = identity.BirthDate.ToShortDateString(); edtBirthPlace.Text = identity.BirthLocation; edtCardNumber.Text = CardNumber.ToString(identity.CardNumber); switch (identity.DocumentType) { case DocumentType.Unknown: edtCardType.Text = "Unknown"; break; case DocumentType.BelgianCitizen: edtCardType.Text = "Belgian Citizen"; break; case DocumentType.EuropeanCommunity: edtCardType.Text = "European Community"; break; case DocumentType.NonEuropeanCommunity: edtCardType.Text = "Non European Community"; break; case DocumentType.KidsCard: edtCardType.Text = "Kids Card"; break; case DocumentType.BootstrapCard: edtCardType.Text = "Bootstrap Card"; break; case DocumentType.HabilitationCard: edtCardType.Text = "Habilitation Card"; break; case DocumentType.ForeignerCard: edtCardType.Text = "Foreigner Card"; break; default: break; } edtChipNumber.Text = identity.ChipNumber; edtCity.Text = address.Municipality; edtFirstName.Text = identity.FirstName1 + " " + identity.FirstName2; edtLastName.Text = identity.Surname; edtMunicipality.Text = identity.Municipality; edtNationality.Text = identity.Nationality; edtNationalNumber.Text = NationalNumber.ToString(identity.NationalNumber); if (identity.Sex == Gender.Female) { edtSex.Text = "F"; } else { edtSex.Text = "M"; } edtValidFrom.Text = identity.ValidityDateBegin.ToShortDateString(); edtValidUntil.Text = identity.ValidityDateEnd.ToShortDateString(); edtZipCode.Text = address.Zip; edtISO.Text = identity.NationalityISO; Image photo = card.ReadPhoto(); if (photo != null) { picturePerson.Image = photo; } else { MessageBox.Show("Can not read EID picture"); } btnCertificate.Enabled = true; } else { MessageBox.Show("Can not read EID card"); } }
private string DetermineCardName() { return(_cardNumber.ToString() + _suit.ToString()); }