/// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (AccountNumber != null)
         {
             hashCode = hashCode * 59 + AccountNumber.GetHashCode();
         }
         if (BankCode != null)
         {
             hashCode = hashCode * 59 + BankCode.GetHashCode();
         }
         if (BankName != null)
         {
             hashCode = hashCode * 59 + BankName.GetHashCode();
         }
         if (BranchCode != null)
         {
             hashCode = hashCode * 59 + BranchCode.GetHashCode();
         }
         if (CheckDigit != null)
         {
             hashCode = hashCode * 59 + CheckDigit.GetHashCode();
         }
         if (CountryCode != null)
         {
             hashCode = hashCode * 59 + CountryCode.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #2
0
        protected override string GenerateBankFileFooter()
        {
            string[] bankFileFooter = new string[7];
            bankFileFooter[0] = "CI";
            bankFileFooter[1] = BankCode.PadRight(3).Substring(0, 3) + BranchCode.PadRight(3).Substring(0, 3) + AccountNo.PadRight(8).Substring(0, 8);
            bankFileFooter[2] = this.AccountHolderName.ToUpper().PadRight(50).Substring(0, 50);
            if (FileType == FileTypeEnum.Autopay)
            {
                bankFileFooter[3] = "CR";
                bankFileFooter[4] = ValueDate.ToString("yyyyMMdd");
                bankFileFooter[5] = RecordCount.ToString("00000");
                bankFileFooter[6] = TotalAmount.ToString("0.00").PadLeft(12);

                string bankFileFooterData = string.Join(FIELD_DELIMITER, bankFileFooter);
                if (bankFileFooterData.Length != 93)
                {
                    throw (new Exception("Incorrect Detail Length of Payment for Footer"));
                }
                return(bankFileFooterData);
            }
            else
            {
                bankFileFooter[3] = ValueDate.ToString("yyyyMMdd");
                bankFileFooter[4] = RecordCount.ToString("00000");
                bankFileFooter[5] = TotalAmount.ToString("0.00").PadLeft(12);
                bankFileFooter[6] = string.Empty.PadLeft(7);

                string bankFileFooterData = string.Join(FIELD_DELIMITER, bankFileFooter);
                if (bankFileFooterData.Length != 98)
                {
                    throw (new Exception("Incorrect Detail Length of Payment for Footer"));
                }
                return(bankFileFooterData);
            }
        }
Example #3
0
 public InstructionDefinition(string name, InstructionArgumentType[] args, BranchCode branchCode)
 {
     Name       = name;
     Arguments  = args;
     OpCode     = OpCode.Branch;
     BranchCode = branchCode;
 }
Example #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (AccountNumber != null ? AccountNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BranchCode != null ? BranchCode.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ BankAccountType.GetHashCode();
         return(hashCode);
     }
 }
Example #5
0
        protected override string GenerateBankFileHeader()
        {
            string[] bankFileHeader = new string[5];

            bankFileHeader[0] = m_BatchID.PadRight(5).Substring(0, 5).Trim();
            bankFileHeader[1] = ((int)m_TransactionType).ToString("00");
            string companyAccountNo = BankCode.PadRight(3).Substring(0, 3) + "-" + BranchCode.PadRight(3).Substring(0, 3) + "-" + AccountNo.PadRight(9).Substring(0, 9).Trim();

            bankFileHeader[2] = companyAccountNo;
            bankFileHeader[3] = AccountHolderName.PadRight(20).Substring(0, 20);
            bankFileHeader[4] = m_BatchName;

            string bankFileHeaderData = "\"" + string.Join(FIELD_DELIMITER, bankFileHeader) + "\"";

            //if (bankFileHeaderDetail.Length != 83)
            //    throw new Exception("Incorrect Bank File Header Length:\r\n" + bankFileHeaderDetail);
            return(bankFileHeaderData);
        }
        /// <summary>
        /// Returns true if BankAccountBban instances are equal
        /// </summary>
        /// <param name="other">Instance of BankAccountBban to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankAccountBban other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                     ) &&
                 (
                     BankCode == other.BankCode ||
                     BankCode != null &&
                     BankCode.Equals(other.BankCode)
                 ) &&
                 (
                     BankName == other.BankName ||
                     BankName != null &&
                     BankName.Equals(other.BankName)
                 ) &&
                 (
                     BranchCode == other.BranchCode ||
                     BranchCode != null &&
                     BranchCode.Equals(other.BranchCode)
                 ) &&
                 (
                     CheckDigit == other.CheckDigit ||
                     CheckDigit != null &&
                     CheckDigit.Equals(other.CheckDigit)
                 ) &&
                 (
                     CountryCode == other.CountryCode ||
                     CountryCode != null &&
                     CountryCode.Equals(other.CountryCode)
                 ));
        }
Example #7
0
        protected override string GenerateBankFileHeader()
        {
            string[] bankFileHeader = new string[13];

            // Record Type 9(1)
            bankFileHeader[0] = "1";
            // Service Type X(10)
            bankFileHeader[1] = "IBGINORM  ";
            // Originating Bank Code 9(3)
            bankFileHeader[2] = BankCode.PadRight(3).Substring(0, 3);
            // Originating Branch Code 9(3)
            bankFileHeader[3] = BranchCode.PadRight(3).Substring(0, 3);
            // Originating Account No 9(11)
            bankFileHeader[4] = ((string)("0" + AccountNo)).PadRight(11).Substring(0, 11);
            // Originating A/C Name
            bankFileHeader[5] = AccountHolderName.PadRight(20).Substring(0, 20);
            // Creation Date 9(8)
            bankFileHeader[6] = AppUtils.ServerDateTime().ToString("yyyyMMdd");
            // Value Date 9(8)
            bankFileHeader[7] = ValueDate.ToString("yyyyMMdd");
            // Filler X(5)
            bankFileHeader[8] = "     ";
            // Hash Indicator X(1)
            bankFileHeader[9] = " ";
            // Payment Advice Header Line1 X(105)
            bankFileHeader[10] = "".PadRight(105);
            // Payment Advice Header Line2 X(105)
            bankFileHeader[11] = "".PadRight(105);
            // Filler X(320)
            bankFileHeader[12] = "".PadRight(320);


            string bankFileHeaderData = string.Join(FIELD_DELIMITER, bankFileHeader);

            if (bankFileHeaderData.Length != 600)
            {
                throw new Exception("Incorrect Bank File Header Length:\r\n" + bankFileHeaderData);
            }
            return(bankFileHeaderData);
        }
Example #8
0
 public override string ActualBankFileName()
 {
     return(BranchCode.PadRight(3).Substring(0, 3) + AccountNo.PadRight(5).Substring(0, 5) + BankFileExtension());
 }
    public CodeData CreateCodeData(TextCovertedData data, EventCodeScriptable scr)
    {
        if (data == null)
        {
            return(new EndCode());
        }
        if (CheckChain(data))
        {
            return(this);
        }
        CodeData result = null;

        switch (data._head)
        {
        case "":
        case "name":    //name[name]
            result = new TextData(data);
            break;

        case "branch":    //branch \nbranchName \n $#1...
            result = new BranchCode(data);
            break;

        case "flag":    //flag[flagName] 5
            result = new FlagCode(data);
            break;

        case "item":    //item[itemName] 1
            result = new ItemCode(data);
            break;

        case "map":    //map[mapName]
            result = new MapCode(data);
            break;

        case "image":    //image[setName,num] back (center)
            result = new ImageCode(data);
            break;

        case "music":    //music[setName,0]
            result = new AudioCode(data);
            break;

        case "battle":    //battle[enemySetName]
            result = new BattleCode(data);
            break;

        case "load":    //load[black] 500
            result = new LoadCode(data);
            break;

        case "wait":    //wait[500]
            result = new WaitCode(data);
            break;

        default:
            return(null);
        }
        result._targetScr = scr;
        return(result);
    }