コード例 #1
0
        public static void Main()
        {
            var depositLihvenCalc = new DepositenLihvenCalculator();
            var depositAccount    = new Account2(new DepositenLihvenCalculator());

            depositAccount.SmetniLihvata();
        }
コード例 #2
0
        public SuiRecordType GetRecordType(SuiRecordReference reference)
        {
            if (reference.Accounts.Contains(Account) && reference.Accounts.Contains(Account2))
            {
                return(SuiRecordType.Transfer);
            }

            if (reference.Accounts.Contains(Account) && string.IsNullOrEmpty(Account2))
            {
                if (reference.CategoriesIn.Contains(Category))
                {
                    return(SuiRecordType.In);
                }

                if (reference.CategoriesOut.Contains(Category))
                {
                    return(SuiRecordType.Out);
                }
            }

            if (!string.IsNullOrEmpty(Account) && !string.IsNullOrEmpty(Account2))
            {
                if (Account.StartsWith(">>") && !Account2.StartsWith(">>") && reference.Loaners.Contains(Account.Substring(2)) && reference.Accounts.Contains(Account2))
                {
                    return(SuiRecordType.Loan);
                }

                if (Account2.StartsWith(">>") && !Account.StartsWith(">>") && reference.Loaners.Contains(Account2.Substring(2)) && reference.Accounts.Contains(Account))
                {
                    return(SuiRecordType.Loan);
                }
            }

            throw new ArgumentOutOfRangeException($"Cannot detect record type by category {Category}, or account {Account} & {Account2}");
        }
コード例 #3
0
        protected void btndeposit_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                Accnum = Convert.ToInt32(ddlWithdraw.SelectedValue);

                using (BNS_DBContainer customer = new BNS_DBContainer())
                {
                    Account2 account = customer.Accounts.SingleOrDefault(x => x.AccountNumber == Accnum);
                    account.Balance -= Convert.ToDouble(txtamount.Text);

                    // Write Transaction to table
                    Transaction withdrawTransaction = new Transaction
                    {
                        Amount  = Convert.ToDouble(txtamount.Text),
                        Details = "Money was removed from account",
                        Date    = DateTime.Now.ToString(),
                        AccountAccountNumber = account.AccountNumber,
                        Type = "Withdrawal"
                    };
                    customer.Transactions.Add(withdrawTransaction);
                    customer.SaveChanges();
                }

                lblResult.Visible = true;
                lblResult.Text    = "Yay!! Money was withdrawed successfully.";
                ClearControls();
            }
        }
コード例 #4
0
        public static void OutTask()
        {
            Console.WriteLine(
                "----Изучение event----\n" +
                "_Событие не может свойством!_" +
                "При вызове события будет вызываться последнее событие в списке вызовов, как и с делегатами\n" +
                "Добавление анонимных методов\n" +
                "Реализация добавления и удаления событий внутри класса\n" +
                "В event мождо добавлять делегат, метод и лямбда-функцию\n" +
                "Можно описывать делегат с использованием своего класса и передавать его 2 параметром\n" +
                "Для событий можно моксимально компактно описать методы, а также расширять класс для передачи в делегат\n");
            Account2 account = new Account2(1000);

            account.Notify += ShowMessage;
            account.TakeMoney(100);
            ShowMessage($"Сумма на счете = {account._bank}");
            account.Notify += ColorMessage;
            account.Notify -= ShowMessage;
            account.PutMoney(40);
            account.Notify -= ColorMessage;
            ShowMessage($"Сумма на счете = {account._bank}");
            account.Notify += ShowMessage;
            account.PutMoney(500);
            ShowMessage($"Сумма на счете = {account._bank}");
            account.Notify -= ShowMessage;

            // добавление анонимных методов
            account.Notify += delegate(string mes)
            {
                Console.WriteLine(mes);
            };
            account.PutMoney(100);
            ShowMessage($"Сумма на счете = {account._bank}");
            account.TakeMoney(200);
            ShowMessage($"Сумма на счете = {account._bank}\n");

            // удаление и добавление событий через методы внутри класса
            Account2 account2 = new Account2(100);

            account2.Notify += ShowMessage;
            account2.PutMoney(20);
            ShowMessage($"Сумма на счете = {account2._bank}");
            account2.Notify -= ShowMessage;
            account2.PutMoney(20);
            ShowMessage($"Сумма на счете = {account2._bank}\n");

            // добавление класса в делегат, не нужно добавлять обработчик на добавление и удаление события
            Account3 account3 = new Account3(100);

            account3.Notify += ShowMessage;
            account3.PutMoney(20);
            account3.TakeMoney(40);
            account3.TakeMoney(5);
        }
コード例 #5
0
        static void Main(string[] args)
        {
            var acct1 = new Account2();

            acct1.Accountnumber = 101;
            acct1.Deposit(200);
            Console.WriteLine($"Account number {acct1.Accountnumber}'s balance is {acct1.Balance}");
            acct1.Withdraw(130);
            Console.WriteLine($"Account number {acct1.Accountnumber}'s balance is {acct1.Balance}");
            acct1.Deposit(40);
            Console.WriteLine($"Account number {acct1.Accountnumber}'s balance is {acct1.Balance}");
            acct1.Withdraw(150);
            Console.WriteLine($"Account number {acct1.Accountnumber}'s balance is {acct1.Balance}");
        }
コード例 #6
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            ApplicationDbContext context = new ApplicationDbContext();
            var             UserManager  = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context));
            ApplicationUser currentUser  = UserManager.FindById(User.Identity.GetUserId());

            Account2 account = new Account2
            {
                AccountType_AccountTID = Convert.ToInt32(DDacc.SelectedValue),
                Balance            = 0.00,
                CustomerCustomerID = currentUser.Id
            };

            BNS_DBContainer customer = new BNS_DBContainer();

            customer.Accounts.Add(account);

            try
            {
                // Your code...
                // Could also be before try if you know the exception occurs in SaveChanges
                customer.SaveChanges();
                String        strConnString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
                SqlConnection con           = new SqlConnection(@strConnString);
                SqlCommand    cmd           = new SqlCommand("cardInsert", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("card", account.AccountNumber);

                con.Open();
                int k = cmd.ExecuteNonQuery();

                con.Close();
            }
            catch (DbEntityValidationException x)
            {
                foreach (var eve in x.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }
            Response.Redirect("Transactions.aspx");
        }
コード例 #7
0
        private void TransferFunds(float amount, string billID)
        {
            using (BNS_DBContainer jpsAccount = new BNS_DBContainer())
            {
                Account2 accountInfo = jpsAccount.Accounts.SingleOrDefault(a => a.AccountNumber == 9190002);
                accountInfo.Balance = accountInfo.Balance + amount;


                Transaction jpsTransaction = new Transaction
                {
                    AccountAccountNumber = accountInfo.AccountNumber,
                    Amount  = amount,
                    Details = $"Payment for JPS Bill {billID}",
                    Type    = "Deposit",
                    Date    = DateTime.Now.ToString()
                };
                jpsAccount.Transactions.Add(jpsTransaction);
                jpsAccount.SaveChanges();
            }
        }
コード例 #8
0
        public void getPayment(float amount, long cardNumber, string billID)
        {
            SqlConnection sqlConnection = new SqlConnection(ConnectionString);

            string qry = "Select AccountAccountNumber from CardNumbers where CardNum='" + cardNumber + "'";

            sqlConnection.Open();

            SqlCommand cmd = new SqlCommand(qry, sqlConnection);

            SqlDataReader reader;

            reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                accountNum = reader.GetInt32(0);
            }

            using (BNS_DBContainer customer = new BNS_DBContainer())
            {
                Account2 account = customer.Accounts.SingleOrDefault(x => x.AccountNumber == accountNum);
                account.Balance = account.Balance - amount;

                Transaction customerTransaction = new Transaction
                {
                    AccountAccountNumber = account.AccountNumber,
                    Amount  = amount,
                    Details = "Payment for JPS Bill " + billID,
                    Type    = "",
                    Date    = DateTime.Now.ToString()
                };

                TransferFunds(amount, billID);
                customer.SaveChanges();
            }
        }
コード例 #9
0
        public void BalanceTest2()
        {
            Account2 a = new Account2();

            Thread t = new Thread(delegate(object o) {
                Account2 b = (Account2)o;
                b.withdraw(5);
            });
            Thread u = new Thread(delegate(object o) {
                Account2 b = (Account2)o;
                b.withdraw(5);
            });

            t.Start(a);
            u.Start(a);
            // put parent thread code here
            a.deposit(10);
            t.Join();
            u.Join();

            int finalBalance = a.read();

            Assert.AreEqual(Account2.InitialBalance, finalBalance);
        }
            public async Task InitializeAsync()
            {
                // TODO (kasobol-msft) find better way
                string connectionString = Environment.GetEnvironmentVariable("AzureWebJobsStorage");

                if (!string.IsNullOrWhiteSpace(connectionString))
                {
                    RandomNameResolver nameResolver = new TestNameResolver();

                    Host = new HostBuilder()
                           .ConfigureDefaultTestHost <MultipleStorageAccountsEndToEndTests>(b =>
                    {
                        b.AddAzureStorageBlobs().AddAzureStorageQueues();
                    })
                           .ConfigureServices(services =>
                    {
                        services.AddSingleton <INameResolver>(nameResolver);
                    })
                           .Build();

                    Account1 = Host.GetStorageAccount();
                    var    config = Host.Services.GetService <IConfiguration>();
                    string secondaryConnectionString = config[$"AzureWebJobs{Secondary}"];
                    Account2 = StorageAccount.NewFromConnectionString(secondaryConnectionString);

                    await CleanContainersAsync();

                    var    blobClient1     = Account1.CreateBlobServiceClient();
                    string inputName       = nameResolver.ResolveInString(Input);
                    var    inputContainer1 = blobClient1.GetBlobContainerClient(inputName);
                    await inputContainer1.CreateIfNotExistsAsync();

                    string outputName = nameResolver.ResolveWholeString(Output);
                    OutputContainer1 = blobClient1.GetBlobContainerClient(outputName);
                    await OutputContainer1.CreateIfNotExistsAsync();

                    var blobClient2     = Account2.CreateBlobServiceClient();
                    var inputContainer2 = blobClient2.GetBlobContainerClient(inputName);
                    await inputContainer2.CreateIfNotExistsAsync();

                    OutputContainer2 = blobClient2.GetBlobContainerClient(outputName);
                    await OutputContainer2.CreateIfNotExistsAsync();

                    var queueClient1 = Account1.CreateQueueServiceClient();
                    var inputQueue1  = queueClient1.GetQueueClient(inputName);
                    await inputQueue1.CreateIfNotExistsAsync();

                    OutputQueue1 = queueClient1.GetQueueClient(outputName);
                    await OutputQueue1.CreateIfNotExistsAsync();

                    var queueClient2 = Account2.CreateQueueServiceClient();
                    var inputQueue2  = queueClient2.GetQueueClient(inputName);
                    await inputQueue2.CreateIfNotExistsAsync();

                    OutputQueue2 = queueClient2.GetQueueClient(outputName);
                    await OutputQueue2.CreateIfNotExistsAsync();

                    string outputTableName = nameResolver.ResolveWholeString(OutputTableName);

                    // upload some test blobs to the input containers of both storage accounts
                    BlockBlobClient blob = inputContainer1.GetBlockBlobClient("blob1");
                    await blob.UploadTextAsync(TestData);

                    blob = inputContainer2.GetBlockBlobClient("blob2");
                    await blob.UploadTextAsync(TestData);

                    // upload some test queue messages to the input queues of both storage accounts
                    await inputQueue1.SendMessageAsync(TestData);

                    await inputQueue2.SendMessageAsync(TestData);

                    Host.Start();
                }
            }
コード例 #11
0
            public async Task InitializeAsync()
            {
                RandomNameResolver nameResolver = new TestNameResolver();

                Host = new HostBuilder()
                       .ConfigureDefaultTestHost <MultipleStorageAccountsEndToEndTests>(b =>
                {
                    b.AddAzureStorage();
                })
                       .ConfigureServices(services =>
                {
                    services.AddSingleton <INameResolver>(nameResolver);
                })
                       .Build();

                Account1 = Host.GetStorageAccount();
                var    config = Host.Services.GetService <IConfiguration>();
                string secondaryConnectionString = config[$"AzureWebJobs{Secondary}"];

                Account2 = StorageAccount.NewFromConnectionString(secondaryConnectionString);

                await CleanContainersAsync();

                CloudBlobClient    blobClient1     = Account1.CreateCloudBlobClient();
                string             inputName       = nameResolver.ResolveInString(Input);
                CloudBlobContainer inputContainer1 = blobClient1.GetContainerReference(inputName);
                await inputContainer1.CreateIfNotExistsAsync();

                string outputName = nameResolver.ResolveWholeString(Output);

                OutputContainer1 = blobClient1.GetContainerReference(outputName);
                await OutputContainer1.CreateIfNotExistsAsync();

                CloudBlobClient    blobClient2     = Account2.CreateCloudBlobClient();
                CloudBlobContainer inputContainer2 = blobClient2.GetContainerReference(inputName);
                await inputContainer2.CreateIfNotExistsAsync();

                OutputContainer2 = blobClient2.GetContainerReference(outputName);
                await OutputContainer2.CreateIfNotExistsAsync();

                CloudQueueClient queueClient1 = Account1.CreateCloudQueueClient();
                CloudQueue       inputQueue1  = queueClient1.GetQueueReference(inputName);
                await inputQueue1.CreateIfNotExistsAsync();

                OutputQueue1 = queueClient1.GetQueueReference(outputName);
                await OutputQueue1.CreateIfNotExistsAsync();

                CloudQueueClient queueClient2 = Account2.CreateCloudQueueClient();
                CloudQueue       inputQueue2  = queueClient2.GetQueueReference(inputName);
                await inputQueue2.CreateIfNotExistsAsync();

                OutputQueue2 = queueClient2.GetQueueReference(outputName);
                await OutputQueue2.CreateIfNotExistsAsync();

                CloudTableClient tableClient1    = Account1.CreateCloudTableClient();
                string           outputTableName = nameResolver.ResolveWholeString(OutputTableName);

                OutputTable1 = tableClient1.GetTableReference(outputTableName);
                OutputTable2 = Account2.CreateCloudTableClient().GetTableReference(outputTableName);

                // upload some test blobs to the input containers of both storage accounts
                CloudBlockBlob blob = inputContainer1.GetBlockBlobReference("blob1");
                await blob.UploadTextAsync(TestData);

                blob = inputContainer2.GetBlockBlobReference("blob2");
                await blob.UploadTextAsync(TestData);

                // upload some test queue messages to the input queues of both storage accounts
                await inputQueue1.AddMessageAsync(new CloudQueueMessage(TestData));

                await inputQueue2.AddMessageAsync(new CloudQueueMessage(TestData));

                Host.Start();
            }
コード例 #12
0
        static void Main(string[] args)
        {
            // simple implimnetation of generic stack
            var stack = new GenericStack <int>();

            stack.Push(888);
            stack.Push(999);
            Console.WriteLine(stack.Pop());

            Console.WriteLine(stack[0]);

            //Generics can be used without explicitly specifying the type
            //As long as type be inferred from the usage
            int x = 88;
            int y = 77;

            GenericSwap.Swap(ref x, ref y);
            Console.WriteLine(x);
            Console.WriteLine(y);

            //The type arguments for method 'GenericSwap.SwapInts<T>(ref int, ref int)'
            //cannot be inferred from the usage. Try specifying the type arguments explicitly.
            //GenericSwap.SwapInts(ref x, ref y);


            decimal t1 = 323;
            double  t2 = 33;

            // Since parameters implicitly specify types, T1 and T2 does not need to be explicitly defined
            Console.WriteLine(MultipleTypeParams.Combine(t1, t2));
            Console.WriteLine(MultipleTypeParams.CombineTypes(t1, t2));


            var array = new int[3];

            array[0] = 55;
            Console.WriteLine(array[0]);
            GenericDefaultValue.Zap(array);
            Console.WriteLine(array[0]);

            var accountList = new Account1[3];

            accountList[0] = new Account1();
            Console.WriteLine(accountList[0]);
            GenericDefaultValue.Zap(accountList); // Will set value to NULL
            Console.WriteLine(accountList[0] == null);

            var account1 = new Account1(); //Account1 impliments both AccountFrozen and IAccountState
            var account2 = new Account2(); //Account2 does not impliment IAccountState

            new GenericMultiConstraints <Account1>().Deposit();

            //The type 'GenericsBuilder.Account2' cannot be used as type parameter 'TState'
            //in the generic type or method 'GenericMultiConstraints<TState>'.
            //There is no implicit reference conversion from 'GenericsBuilder.Account2' to 'GenericsBuilder.IAccountState'.
            //new GenericMultiConstraints<Account2>().Deposit();


            GenericMethodWithConstraints.ProcessStruct <int>();

            //The type 'string' must be a non-nullable value type in order to use it as parameter 'TKey'
            //in the generic type or method 'GenericMethodWithConstraints.ProcessStruct<TKey>()'
            //GenericMethodWithConstraints.ProcessStruct<string>();

            // 'Max' is a generic method with IComaparable constraint
            // All types passed into this method should impliment IComaparable<T>
            // This allows the method to use 'CompareTo' method with the type parameter
            var maxString = GenericMethodWithConstraints.Max("home1", "home2");

            Console.WriteLine(maxString);

            var maxInt = GenericMethodWithConstraints.Max(1, 2);

            Console.WriteLine(maxInt);


            var home1 = new Home()
            {
                Area = 500
            };
            var home2 = new Home()
            {
                Area = 200
            };


            var homeWithMaxArea = GenericMethodWithConstraints.Max(home1, home2);

            Console.WriteLine(homeWithMaxArea.Area);

            /*
             *
             *  var students = new Students();
             *
             *  Console.WriteLine(students[0].Name);
             *  Console.WriteLine(students[0].Age);
             *  Console.WriteLine(students[2].Name);
             */

            //var dic = new Dictionary<int, int>();


            // Generic types can be overloaded within the same namesapce based on the number of type arguments
            var newOverloadedGenericType  = new OverloadType <int>();
            var newOverloadedGenericType2 = new OverloadType <int, string>();
            var newOverloadedGenericType3 = new OverloadType <int, int, int>();


            //Usig generic extension method with generic delegate to convert from one type to another
            string number = "99";

            var intNumber = number.ConvertToType(TypeConverter.ConvertStringToInt);

            Console.WriteLine(intNumber);

            // Array extension method with generic delegates to convert array type
            string[] intArray = new string[] { "false", "true", "0", "1" };

            bool[] resultArray = intArray.ConvertArrayToType(TypeConverter.ConvertStringToBool);

            for (int i = 0; i < resultArray.Length; i++)
            {
                Console.WriteLine(resultArray[i]);
            }

            // RefTypeConstraintStruct is a generic struct with constraints
            //that only takes 'reference' type as the type argument
            var refTypeStruct1 = new RefTypeConstraintStruct <Student>();
            var refTypeStruct2 = new RefTypeConstraintStruct <int[]>();

            //GenericsBuilder.RefTypeConstraintStruct`1[GenericsBuilder.Student]
            //GenericsBuilder.RefTypeConstraintStruct`1[System.Int32[]]
            Console.WriteLine(refTypeStruct1.ToString());
            Console.WriteLine(refTypeStruct2.ToString());

            //The type 'int' must be a reference type in order to use it as parameter 'T' in the generic type or
            //method 'RefTypeConstraintStruct<T>'
            //var refTypeStruct3 = new RefTypeConstraintStruct<int>();

            var valTypeConstraint1 = new ValueTypeConstraintClass <AccountType>();

            //The type 'Student' must be a non-nullable value type in order to use it as parameter 'T'
            //var valTypeConstraint2 = new ValueTypeConstraintClass<Student>();

            // generic classes with constructor type constraints require a class that has
            //implicit or explicit parameterless constructor
            var ctorContraint1 = new ConstructorTypeConstraint <ClassWithParamlessCtor>();

            //'ClassWithExplicitCtor' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T'
            //in the generic type or method 'ConstructorTypeConstraint<T>'
            //var ctorContraint2 = new ConstructorTypeConstraint<ClassWithExplicitCtor>();

            // type argument must be a class derived from abstract class 'Stream'
            var stream1 = new ConversionTypeConstraint <FileStream>();

            // Invalid argement violating conversion type constraint
            //The type 'System.Text.StringBuilder' cannot be used as type parameter 'T'
            //in the generic type or method 'ConversionTypeConstraint<T>'.
            //There is no implicit reference conversion from 'System.Text.StringBuilder' to 'System.IO.Stream'
            //var stream2 = new ConversionTypeConstraint<StringBuilder>();


            var multiConvert = new ConversionTypeConstraint <FileStream, Stream>();

            //use of unbound generic type without the use of arguments
            Type type1 = typeof(UnboundType <>);

            Console.WriteLine(type1.FullName); //GenericsBuilder.UnboundType`1
            // comma added to specify that this is the unbound type with 2 type paramaeters
            Type type2 = typeof(UnboundType <,>);

            Console.WriteLine(type2.FullName); //GenericsBuilder.UnboundType`2

            Type type3 = typeof(UnboundType <int, double>);

            //GenericsBuilder.UnboundType`2
            //[[System.Int32, System.Private.CoreLib, Version=4.0.0.0],
            //[System.Double, System.Private.CoreLib, Version=4.0.0.0]
            Console.WriteLine(type3.FullName);


            var refAndStruct = new MultiConstraintsRef <ICusRefType, CusStruct>();
        }
コード例 #13
0
        // OLD signature notice the case, this did NOT work with the deserialise
        //   public String batch_id, myinterface, voucher_type, trans_type, client, account, dim_1, dim_2, dim_3, dim_4,
        //    dim_5, dim_6, dim_7, tax_code, tax_system, currency, dc_flag, cur_amount, amount, number_1,
        //    value_1, value_2, value_3, description, trans_date, voucher_date, voucher_no, period, tax_flag, ext_inv_ref,
        //    ext_ref, due_date, disc_date, discount, commitment, order_id, kid, pay_transfer, status, apar_type,
        //    apar_id, pay_flag, voucher_ref, sequence_ref, intrule_id, factor_short, responsible, apar_name, address, province,
        //    place, bank_account, pay_method, vat_reg_no, zip_code, curr_licence, account2, base_amount, base_curr, pay_temp_id,
        //    allocation_key, period_no, clearing_code, swift, arrive_id, bank_acc_type
        //;

        public String beautifyGL07()
        {
            // this function will process the NULL values and return a GL07 fixed width line
            // ? allows null to not give a runtime error
            // ?? is effectively a coalesce.  do the right side of the ?? if the left side is null else do the left side
            PayMethod     = PayMethod?.Trim().PadRight(2).Substring(0, 2) ?? "".PadRight(2);
            BatchId       = BatchId?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Interface     = Interface?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            VoucherType   = VoucherType?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            TransType     = TransType?.Trim().PadRight(2).Substring(0, 2) ?? "".PadRight(2);
            Client        = Client?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Account       = Account?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Cat1          = Cat1?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Cat2          = Cat2?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Cat3          = Cat3?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Cat4          = Cat4?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Cat5          = Cat5?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Cat6          = Cat6?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Cat7          = Cat7?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            TaxCode       = TaxCode?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            TaxSystem     = TaxSystem?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Currency      = Currency?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            DcFlag        = DcFlag?.Trim().PadRight(2).Substring(0, 2) ?? "".PadRight(2);
            CurAmount     = CurAmount.Trim().PadLeft(20);
            Amount        = Amount.Trim().PadLeft(20);
            Number1       = Number1.Trim().PadLeft(11);
            Value1        = Value1.Trim().PadLeft(20);
            Value2        = Value2.Trim().PadLeft(20);
            Value3        = Value3.Trim().PadLeft(20);
            Description   = Description?.Trim().PadRight(255).Substring(0, 255) ?? "".PadRight(255);
            TransDate     = TransDate?.Trim().PadRight(8).Substring(0, 8) ?? "".PadRight(8);
            VoucherDate   = VoucherDate?.Trim().PadRight(8).Substring(0, 8) ?? "".PadRight(8);
            VoucherNo     = VoucherNo?.Trim().PadRight(15).Substring(0, 15) ?? "".PadRight(15);
            Period        = Period?.Trim().PadRight(6).Substring(0, 6) ?? "".PadRight(6);
            TaxFlag       = TaxFlag?.Trim().PadRight(1).Substring(0, 1) ?? "".PadRight(1);
            ExtInvRef     = ExtInvRef?.Trim().PadRight(100).Substring(0, 100) ?? "".PadRight(100);
            ExtRef        = ExtRef?.Trim().PadRight(255).Substring(0, 255) ?? "".PadRight(255);
            DueDate       = DueDate?.Trim().PadRight(8).Substring(0, 8) ?? "".PadRight(8);
            DiscDate      = DiscDate?.Trim().PadRight(8).Substring(0, 8) ?? "".PadRight(8);
            Discount      = Discount?.Trim().PadRight(20).Substring(0, 20) ?? "".PadRight(20);
            Commitment    = Commitment?.Trim().PadLeft(25).Substring(0, 25) ?? "".PadRight(25);
            OrderId       = OrderId?.Trim().PadRight(15).Substring(0, 15) ?? "".PadRight(15);
            Kid           = Kid?.Trim().PadRight(27).Substring(0, 27) ?? "".PadRight(27);
            PayTransfer   = PayTransfer?.Trim().PadRight(2).Substring(0, 2) ?? "".PadRight(2);
            Status        = Status?.Trim().PadRight(1).Substring(0, 1) ?? "".PadRight(1);
            AparType      = AparType?.Trim().PadRight(1).Substring(0, 1) ?? "".PadRight(1);
            AparId        = AparId?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            PayFlag       = PayFlag?.Trim().PadRight(1).Substring(0, 1) ?? "".PadRight(1);
            VoucherRef    = VoucherRef?.Trim().PadRight(15).Substring(0, 15) ?? "".PadRight(15);
            SequenceRef   = SequenceRef?.Trim().PadRight(9).Substring(0, 9) ?? "".PadRight(9);
            IntruleId     = IntruleId?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            FactorShort   = FactorShort?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            Responsible   = Responsible?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            AparName      = AparName?.Trim().PadRight(255).Substring(0, 255) ?? "".PadRight(255);
            Address       = Address?.Trim().PadRight(160).Substring(0, 160) ?? "".PadRight(160);
            Province      = Province?.Trim().PadRight(40).Substring(0, 40) ?? "".PadRight(40);
            Place         = Place?.Trim().PadRight(40).Substring(0, 40) ?? "".PadRight(40);
            BankAccount   = BankAccount?.Trim().PadRight(35).Substring(0, 35) ?? "".PadRight(35);
            PayMethod     = PayMethod?.Trim().PadRight(2).Substring(0, 2) ?? "".PadRight(2);
            VatRegNo      = VatRegNo?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            ZipCode       = ZipCode?.Trim().PadRight(15).Substring(0, 15) ?? "".PadRight(15);
            CurrLicence   = CurrLicence?.Trim().PadRight(3).Substring(0, 3) ?? "".PadRight(3);
            Account2      = Account2?.Trim().PadRight(25).Substring(0, 25) ?? "".PadRight(25);
            BaseAmount    = BaseAmount?.Trim().PadLeft(20).Substring(0, 20) ?? "".PadRight(20);
            BaseCurr      = BaseCurr?.Trim().PadLeft(20).Substring(0, 20) ?? "".PadRight(20);
            PayTempId     = PayTempId?.Trim().PadRight(4).Substring(0, 4) ?? "".PadRight(4);
            AllocationKey = AllocationKey?.Trim().PadRight(2).Substring(0, 2) ?? "".PadRight(2);
            PeriodNo      = PeriodNo?.Trim().PadRight(2).Substring(0, 2) ?? "".PadRight(2);
            Clearingcode  = Clearingcode?.Trim().PadRight(13).Substring(0, 13) ?? "".PadRight(13);
            Swift         = Swift?.Trim().PadRight(11).Substring(0, 11) ?? "".PadRight(11);
            Arriveid      = Arriveid?.Trim().PadRight(15).Substring(0, 15) ?? "".PadRight(15);
            BankAccType   = BankAccType?.Trim().PadRight(2).Substring(0, 2) ?? "".PadRight(2);

            return(BatchId + Interface + VoucherType + TransType + Client
                   + Account + Cat1 + Cat2 + Cat3 + Cat4
                   + Cat5 + Cat6 + Cat7 + TaxCode + TaxSystem + Currency
                   + DcFlag + CurAmount + Amount + Number1 + Value1 + Value2
                   + Value3 + Description + TransDate + VoucherDate + VoucherNo
                   + Period + TaxFlag + ExtInvRef + ExtRef + DueDate + DiscDate
                   + Discount + Commitment + OrderId + Kid + PayTransfer + Status
                   + AparType + AparId + PayFlag + VoucherRef + SequenceRef + IntruleId
                   + FactorShort + Responsible + AparName + Address + Province + Place
                   + BankAccount + PayMethod + VatRegNo + ZipCode + CurrLicence + Account2
                   + BaseAmount + BaseCurr + PayTempId + AllocationKey + PeriodNo + Clearingcode
                   + Swift + Arriveid + BankAccType
                   );


            //       String GL07Line = fw.BatchId.Trim().PadRight(25) + fw.Interface?.Trim().PadRight(25) + fw.VoucherType.Trim().PadRight(25) + fw.TransType.Trim().PadRight(2) + fw.Client.Trim().PadRight(25)
            //+ fw.Account.Trim().PadRight(25) + fw.Cat1.Trim().PadRight(25) + fw.Cat2.Trim().PadRight(25) + fw.Cat3.Trim().PadRight(25) + fw.Cat4.Trim().PadRight(25)
            //+ fw.Cat5.Trim().PadRight(25) + fw.Cat6.Trim().PadRight(25) + fw.Cat7.Trim().PadRight(25) + fw.TaxCode.Trim().PadRight(25) + fw.TaxSystem.Trim().PadRight(25) + fw.Currency.Trim().PadRight(25)
            //+ fw.DcFlag.Trim().PadRight(2) + fw.CurAmount.Trim().PadLeft(20) + fw.Amount.Trim().PadLeft(20) + fw.Number1.Trim().PadLeft(11) + fw.Value1.Trim().PadLeft(20) + fw.Value2.Trim().PadLeft(20)
            //+ fw.Value3.Trim().PadLeft(20) + fw.Description.Trim().PadRight(255) + fw.TransDate.Trim().PadRight(8) + fw.VoucherDate.Trim().PadRight(8) + fw.VoucherNo.Trim().PadRight(15)
            //+ fw.Period.Trim().PadRight(6) + fw.TaxFlag.Trim().PadRight(1) + fw.ExtInvRef.Trim().PadRight(100) + fw.ExtRef.Trim().PadRight(255) + fw.DueDate.Trim().PadRight(8) + fw.DiscDate.Trim().PadRight(8)
            //+ fw.Discount.Trim().PadRight(20) + fw.Commitment.Trim().PadLeft(25) + fw.OrderId.Trim().PadRight(15) + fw.Kid.Trim().PadRight(27) + fw.PayTransfer.Trim().PadRight(2) + fw.PayTransfer.Trim().PadRight(1)
            //+ fw.AparType.Trim().PadRight(1) + fw.AparId.Trim().PadRight(25) + fw.PayFlag.Trim().PadRight(1) + fw.VoucherRef.Trim().PadRight(15) + fw.SequenceRef.Trim().PadRight(9) + fw.IntruleId.Trim().PadRight(25)
            //+ fw.FactorShort.Trim().PadRight(25) + fw.Responsible.Trim().PadRight(25) + fw.AparName.Trim().PadRight(255) + fw.Address.Trim().PadRight(160) + fw.Province.Trim().PadRight(40) + fw.Place.Trim().PadRight(40)
            //+ fw.BankAccount.Trim().PadRight(35) + fw.PayMethod + fw.VatRegNo.Trim().PadRight(25) + fw.ZipCode.Trim().PadRight(15) + fw.CurrLicence.Trim().PadRight(3) + fw.Account2.Trim().PadRight(25)
            //+ fw.BaseAmount.Trim().PadLeft(20) + fw.BaseCurr.Trim().PadLeft(20) + fw.PayTempId.Trim().PadRight(4) + fw.AllocationKey.Trim().PadRight(2) + fw.PeriodNo.Trim().PadRight(2) + fw.Clearingcode.Trim().PadRight(13)
            //+ fw.Swift.Trim().PadRight(11) + fw.Arriveid.Trim().PadRight(15) + fw.BankAccType.Trim().PadRight(2)
            // ;
        }
            public TestFixture()
            {
                RandomNameResolver   nameResolver      = new RandomNameResolver();
                JobHostConfiguration hostConfiguration = new JobHostConfiguration()
                {
                    NameResolver = nameResolver,
                    TypeLocator  = new FakeTypeLocator(typeof(MultipleStorageAccountsEndToEndTests)),
                };

                Config = hostConfiguration;

                Account1 = CloudStorageAccount.Parse(hostConfiguration.StorageConnectionString);
                string secondaryConnectionString = AmbientConnectionStringProvider.Instance.GetConnectionString(Secondary);

                Account2 = CloudStorageAccount.Parse(secondaryConnectionString);

                CleanContainers();

                CloudBlobClient    blobClient1     = Account1.CreateCloudBlobClient();
                string             inputName       = nameResolver.ResolveInString(Input);
                CloudBlobContainer inputContainer1 = blobClient1.GetContainerReference(inputName);

                inputContainer1.Create();
                string outputName = nameResolver.ResolveWholeString(Output);

                OutputContainer1 = blobClient1.GetContainerReference(outputName);
                OutputContainer1.CreateIfNotExists();

                CloudBlobClient    blobClient2     = Account2.CreateCloudBlobClient();
                CloudBlobContainer inputContainer2 = blobClient2.GetContainerReference(inputName);

                inputContainer2.Create();
                OutputContainer2 = blobClient2.GetContainerReference(outputName);
                OutputContainer2.CreateIfNotExists();

                CloudQueueClient queueClient1 = Account1.CreateCloudQueueClient();
                CloudQueue       inputQueue1  = queueClient1.GetQueueReference(inputName);

                inputQueue1.CreateIfNotExists();
                OutputQueue1 = queueClient1.GetQueueReference(outputName);
                OutputQueue1.CreateIfNotExists();

                CloudQueueClient queueClient2 = Account2.CreateCloudQueueClient();
                CloudQueue       inputQueue2  = queueClient2.GetQueueReference(inputName);

                inputQueue2.CreateIfNotExists();
                OutputQueue2 = queueClient2.GetQueueReference(outputName);
                OutputQueue2.CreateIfNotExists();

                CloudTableClient tableClient1    = Account1.CreateCloudTableClient();
                string           outputTableName = nameResolver.ResolveWholeString(OutputTableName);

                OutputTable1 = tableClient1.GetTableReference(outputTableName);
                OutputTable2 = Account2.CreateCloudTableClient().GetTableReference(outputTableName);

                // upload some test blobs to the input containers of both storage accounts
                CloudBlockBlob blob = inputContainer1.GetBlockBlobReference("blob1");

                blob.UploadText(TestData);
                blob = inputContainer2.GetBlockBlobReference("blob2");
                blob.UploadText(TestData);

                // upload some test queue messages to the input queues of both storage accounts
                inputQueue1.AddMessage(new CloudQueueMessage(TestData));
                inputQueue2.AddMessage(new CloudQueueMessage(TestData));

                Host = new JobHost(hostConfiguration);
                Host.Start();
            }