コード例 #1
0
        public void ValidNumberMustHaveCorrectChecksum(long number, int checkDigit, int expectedCheckDigit)
        {
            var invalidIdNumber = new IdentificationNumber(number, checkDigit);

            Assert.False(invalidIdNumber.IsValid);
            Assert.Equal(expectedCheckDigit, invalidIdNumber.ExpectedCheckDigit);
        }
コード例 #2
0
        public void ExpectedCheckDigitIsCalculateAsWeightedSumModulo11(long invalidIdNumber, int checkDigit, int expectedCheckDigit)
        {
            var idNumber = new IdentificationNumber(invalidIdNumber, checkDigit);

            Assert.False(idNumber.IsValid, "Last digit is not correct.");
            Assert.Equal(expectedCheckDigit, idNumber.ExpectedCheckDigit);
        }
コード例 #3
0
 private void rbManufacturerId_CheckedChanged(object sender, EventArgs e)
 {
     if (!(identificationNumber is ManufacturerIdentificationNumber))
     {
         identificationNumber = new ManufacturerIdentificationNumber();
     }
     SetControlStates();
 }
コード例 #4
0
 private void rbUserId_CheckedChanged(object sender, EventArgs e)
 {
     if (!(identificationNumber is UserDefinedIdentificationNumber))
     {
         identificationNumber = new UserDefinedIdentificationNumber();
     }
     SetControlStates();
 }
コード例 #5
0
        public void TwoIdenfierNumbers_WithSameValue_AreEqual()
        {
            var lhs = new IdentificationNumber(1257, 2);
            var rhs = new IdentificationNumber(1257, 2);

            Assert.Equal(lhs.GetHashCode(), rhs.GetHashCode());
            Assert.True(lhs.Equals((object)rhs));
            Assert.True(lhs.Equals(rhs));
            Assert.True(lhs == rhs);
            Assert.False(lhs != rhs);
        }
コード例 #6
0
        public void TwoIdenfierNumbers_WithDifferentValue_AreNotEqual(long lhsNum, int lhsDigit, long rhsNum, int rhsDigit)
        {
            var lhs = new IdentificationNumber(lhsNum, lhsDigit);
            var rhs = new IdentificationNumber(rhsNum, rhsDigit);

            Assert.False(lhs.GetHashCode() == rhs.GetHashCode(), "In general, different values can have same hash code, but in this particular case they don't have it.");
            Assert.False(lhs.Equals((object)rhs));
            Assert.False(lhs.Equals(rhs));
            Assert.False(lhs == rhs);
            Assert.True(lhs != rhs);
        }
コード例 #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Name.GetHashCode();
         hashCode = (hashCode * 397) ^ Id.GetHashCode();
         hashCode = (hashCode * 397) ^ Surname.GetHashCode();
         hashCode = (hashCode * 397) ^ IdentificationNumber.GetHashCode();
         hashCode = (hashCode * 397) ^ (Email?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ DateOfBirth.GetHashCode();
         hashCode = (hashCode * 397) ^ ProfileCreationDate.GetHashCode();
         return(hashCode);
     }
 }
コード例 #8
0
        private void IndentificationNumbersListControl_OnAdd()
        {
            var form = new IdentificationNumberForm();

            form.IdentificationNumber = new IdentificationNumber();
            if (DialogResult.OK == form.ShowDialog())
            {
                IdentificationNumber id = form.IdentificationNumber;
                String idType           = "";
                if (id is ManufacturerIdentificationNumber)
                {
                    idType = "MFR";
                }
                else if (id is UserDefinedIdentificationNumber)
                {
                    idType = "USR";
                }

                var lvi = new ListViewItem(idType);
                lvi.SubItems.Add(id.number);
                lvi.SubItems.Add(id.type.ToString());
                lvi.SubItems.Add(id is UserDefinedIdentificationNumber
                    ? ((UserDefinedIdentificationNumber)id).qualifier
                    : "");
                if (id is ManufacturerIdentificationNumber)
                {
                    lvi.SubItems.Add(((ManufacturerIdentificationNumber)id).manufacturerName);
                }
                else
                {
                    lvi.SubItems.Add("");
                }
                lvi.Tag = id;
                Items.Add(lvi);
                if (_identificationNumbers == null)
                {
                    _identificationNumbers = new List <IdentificationNumber>();
                }
                _identificationNumbers.Add(id);
                lvi.BackColor = lvi.Index % 2 == 0 ? ATMLContext.COLOR_LIST_EVEN : ATMLContext.COLOR_LIST_ODD;
            }
        }
コード例 #9
0
 public virtual bool IsAt(string anIdentificationType, string anIdentificationNumber)
 {
     return(IdentificationNumber.Equals(anIdentificationNumber) &&
            IdentificationType.Equals(anIdentificationType));
 }
コード例 #10
0
        public void Format_WillFormatIdentificationNumberInStandardPattern()
        {
            var identificationNumber = new IdentificationNumber(123, 5);

            Assert.Equal(identificationNumber.ToString("S", null), pattern.Format(identificationNumber));
        }
コード例 #11
0
        public void CheckDigitFromStandardFormConstructorCanBeRetrievedFromProperty(int checkDigit)
        {
            var idNumber = new IdentificationNumber(0, checkDigit);

            Assert.Equal(checkDigit, idNumber.CheckDigit);
        }
コード例 #12
0
        public override bool Equals(object obj)
        {
            var user = obj as User;

            return(user.IdentificationNumber.ToUpper().Equals(IdentificationNumber.ToUpper()) && user.Email.ToUpper().Equals(Email.ToUpper()));
        }
コード例 #13
0
 /// <summary>   Converts this object to a row. </summary>
 /// <returns>   This object as a string. </returns>
 public string ToRow()
 {
     return
         ($"{Volume.ToDatev()};{Claim.ToDatev()};{CurrencySymbol.ToDatev()};{ExchangeRage.ToDatev()};{BasicVolume.ToDatev()};{BasicVolumeCurrencySymbol.ToDatev()};{AccountNumber.ToDatev()};{ContraAccountNumber.ToDatev()};{TaxKey.ToDatev()};{Date.ToShortDatevDate()};{DocumentField1.ToDatev()};{DocumentField2.ToDatev()};{CashDiscount.ToDatev()};{BookingText.ToDatev()};{Blocked.ToDatev()};{DiverseAccountNumber.ToDatev()};{PartnerBank.ToDatev()};{Circumstances.ToDatev()};{InterestBlock.ToDatev()};{DocumentLink.ToDatev()};{BookingInfoType1.ToDatev()};{BookingInfoContent1.ToDatev()};{BookingInfoType2.ToDatev()};{BookingInfoContent2.ToDatev()};{BookingInfoType3.ToDatev()};{BookingInfoContent3.ToDatev()};{BookingInfoType4.ToDatev()};{BookingInfoContent4.ToDatev()};{BookingInfoType5.ToDatev()};{BookingInfoContent5.ToDatev()};{BookingInfoType6.ToDatev()};{BookingInfoContent6.ToDatev()};{BookingInfoType7.ToDatev()};{BookingInfoContent7.ToDatev()};{BookingInfoType8.ToDatev()};{BookingInfoContent8.ToDatev()};{CostCenter1.ToDatev()};{CostCenter2.ToDatev()};{CostAmount.ToDatev()};{CountryCodeAndTaxId.ToDatev()};{EuroTax.ToDatev()};{DifferentTaxType.ToDatev()};{IntentionLL.ToDatev()};{FunctionLL.ToDatev()};{BU49FunctionType.ToDatev()};{BU49FunctionNumber.ToDatev()};{BU49FunctionAddition.ToDatev()};{AdditionalInfoType1.ToDatev()};{AdditionalInfoContent1.ToDatev()};{AdditionalInfoType2.ToDatev()};{AdditionalInfoContent2.ToDatev()};{AdditionalInfoType3.ToDatev()};{AdditionalInfoContent3.ToDatev()};{AdditionalInfoType4.ToDatev()};{AdditionalInfoContent4.ToDatev()};{AdditionalInfoType5.ToDatev()};{AdditionalInfoContent5.ToDatev()};{AdditionalInfoType6.ToDatev()};{AdditionalInfoContent6.ToDatev()};{AdditionalInfoType7.ToDatev()};{AdditionalInfoContent7.ToDatev()};{AdditionalInfoType8.ToDatev()};{AdditionalInfoContent8.ToDatev()};{AdditionalInfoType9.ToDatev()};{AdditionalInfoContent9.ToDatev()};{AdditionalInfoType10.ToDatev()};{AdditionalInfoContent10.ToDatev()};{AdditionalInfoType11.ToDatev()};{AdditionalInfoContent11.ToDatev()};{AdditionalInfoType12.ToDatev()};{AdditionalInfoContent12.ToDatev()};{AdditionalInfoType13.ToDatev()};{AdditionalInfoContent13.ToDatev()};{AdditionalInfoType14.ToDatev()};{AdditionalInfoContent14.ToDatev()};{AdditionalInfoType15.ToDatev()};{AdditionalInfoContent15.ToDatev()};{AdditionalInfoType16.ToDatev()};{AdditionalInfoContent16.ToDatev()};{AdditionalInfoType17.ToDatev()};{AdditionalInfoContent17.ToDatev()};{AdditionalInfoType18.ToDatev()};{AdditionalInfoContent18.ToDatev()};{AdditionalInfoType19.ToDatev()};{AdditionalInfoContent19.ToDatev()};{AdditionalInfoType20.ToDatev()};{AdditionalInfoContent20.ToDatev()};{Amount.ToDatev()};{Weight.ToDatev()};{PaymentType.ToDatev()};{ClaimType.ToDatev()};{CommunalYear.ToShortDatevYear()};{CommunalDueYear.ToShortDatevYear()};{CashDiscountType.ToDatev()};{OrderNumber.ToDatev()};{BookingType.ToDatev()};{TaxKeyPrepayment.ToDatev()};{CountryCodePrePayment.ToDatev()};{IntentionLLPrepayment.ToDatev()};{EuroTaxPrepayment.ToDatev()};{AccountNumberPrepayment.ToDatev()};\"SV\";{BookingGuid.ToDatev()};{CostDate.ToDatevDateReverse()};{SepaReference.ToDatev()};{CashDiscountBlock.ToDatev()};{Proprietor.ToDatev()};{ParticipantNumber.ToDatev()};{IdentificationNumber.ToDatev()};{PainterNumber.ToDatev()};{BatchBlockTill.ToDatevDateReverse()};{SoBilIntention.ToDatev()};{SoBilKey.ToDatev()};{Fixing.ToDatev()};{ActivityDate.ToDatevDateReverse()};{ActivityDate.ToDatevDateReverse()}");
 }
コード例 #14
0
ファイル: IsValidBenchmark.cs プロジェクト: khellang/Redskap
 public bool Redskap()
 {
     return(IdentificationNumber.IsValid(Value));
 }
コード例 #15
0
 public override int GetHashCode()
 {
     return(IdentificationNumber.GetHashCode() + Email.GetHashCode());
 }
コード例 #16
0
ファイル: GenerateBenchmark.cs プロジェクト: khellang/Redskap
 public IdentificationNumber Redskap()
 {
     return(IdentificationNumber.Generate(IdentificationNumber.Kind.FNumber, DateTime.Now));
 }
コード例 #17
0
        public void NumberFromStandardFormConstructorCanBeRetrievedFromProperty(int number)
        {
            var idNumber = new IdentificationNumber(number, 0);

            Assert.Equal(number, idNumber.Number);
        }
コード例 #18
0
        private Contract ConvertBatchContractToContract(BatchContract batchContract)
        {
            /* Map BatchContract to Contract */
            Contract contract = new Contract()
            {
                contractCode = batchContract.ContractCode,

                /* Map BatchContractContractData to Contract */
                phaseOfContract = batchContract.ContractData.PhaseOfContract == ContractPhaseOfContract.Open ? "Open" : "Close",
                originalAmount  = new Amount()
                {
                    value = batchContract.ContractData.OriginalAmount.Value, currency = batchContract.ContractData.OriginalAmount.Currency.ToString()
                },
                installmentAmount = new Amount()
                {
                    value = batchContract.ContractData.InstallmentAmount.Value, currency = batchContract.ContractData.InstallmentAmount.Currency.ToString()
                },
                currentBalance = new Amount()
                {
                    value = batchContract.ContractData.CurrentBalance.Value, currency = batchContract.ContractData.CurrentBalance.Currency.ToString()
                },
                overdueBalance = new Amount()
                {
                    value = batchContract.ContractData.OverdueBalance.Value, currency = batchContract.ContractData.OverdueBalance.Currency.ToString()
                },
                dateOfLastPayment = batchContract.ContractData.DateOfLastPayment,
                nextPaymentDate   = batchContract.ContractData.NextPaymentDate,
                dateAccountOpened = batchContract.ContractData.DateAccountOpened,
                realEndDate       = batchContract.ContractData.RealEndDate
            };

            /* Map BatchContractIndividuals to Individuals and add them into Contract */
            contract.individuals = new List <Individual>();
            foreach (BatchContractIndividual batchIndividual in batchContract.Individual)
            {
                Individual individual = new Individual()
                {
                    CustomerCode = batchIndividual.CustomerCode,
                    contractCode = contract.contractCode,
                    FirstName    = batchIndividual.FirstName,
                    LastName     = batchIndividual.LastName,

                    Gender      = batchIndividual.Gender.ToString(),
                    DateOfBirth = batchIndividual.DateOfBirth,
                };

                IdentificationNumber identNo = new IdentificationNumber()
                {
                    nationalID = batchIndividual.IdentificationNumbers.NationalID, individual = individual
                };
                individual.identificationNumbers = new List <IdentificationNumber>();
                individual.identificationNumbers.Add(identNo);

                contract.individuals.Add(individual);
            }

            /* Map BatchContractSubjectRoles to SubjectRoles and add them into Contract */
            contract.subjectRoles = new List <SubjectRole>();
            foreach (BatchContractSubjectRole batchSubjectRole in batchContract.SubjectRole)
            {
                SubjectRole subjectRole = new SubjectRole()
                {
                    contractCode   = contract.contractCode,
                    customerCode   = batchSubjectRole.CustomerCode,
                    roleOfCustomer = batchSubjectRole.RoleOfCustomer.ToString()
                };

                if (batchSubjectRole.GuaranteeAmount != null)
                {
                    subjectRole.guaranteeAmount = new Amount(amount: batchSubjectRole.GuaranteeAmount.Value, currency: batchSubjectRole.GuaranteeAmount.Currency.ToString());
                }
                else
                {
                    subjectRole.guaranteeAmount = new Amount()
                    {
                        value = 0, currency = ""
                    };
                }

                contract.subjectRoles.Add(subjectRole);
            }

            return(contract);
        }