Beispiel #1
0
        public ActionResult Verify(Account1 acc)
        {
            ConnectionString();
            con.Open();
            com.Connection  = con;
            com.CommandText = "select * from dbo.LOGIN_TABLE where username='******' and password='******'";
            dr = com.ExecuteReader();


            if (dr.Read())
            {
                string temp = dr.GetValue(0).ToString();
                if (temp.Contains("admin_"))
                {
                    con.Close();
                    return(View("/Views/Administrators/Index.cshtml", new List <Administrator>()));
                }
                if (temp.Contains("stud_"))
                {
                    var uvtdemosdbContext = _context.Student.Include(s => s.IdCameraNavigation);
                    con.Close();
                    return(View("/Views/Students/Index.cshtml", uvtdemosdbContext.ToList()));
                }
            }
            con.Close();
            return(View("Error"));
        }
Beispiel #2
0
        public ActionResult Verify(Account1 acc)
        {
            con.ConnectionString = "Data Source=LAPTOP-3OSSUTQ9;Initial Catalog=AppDB;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework";

            con.Open();
            com.Connection  = con;
            com.CommandText = "select * from [User] where Username ='******' and Password ='******'";
            dr = com.ExecuteReader();
            if (dr.Read())
            {
                Session["id"]     = Int32.Parse(dr["UserID"].ToString());
                Session["userid"] = acc.Username;
                con.Close();
                if (acc.Username.Equals("admin", StringComparison.OrdinalIgnoreCase))
                {
                    return(RedirectToAction("admin", "admin"));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            else
            {
                con.Close();
                ViewBag.DuplicateMessage = "Invalid Credentials";
                return(View("Login1", acc));
            }
        }
Beispiel #3
0
 public void Main(string[] args)
 {
     Account1 a = new Account1();
     a.accName = "Rahim Ahmed";
     a.acid = "Rahim01";
     a.balance = 434544;
     Console.WriteLine("Deposit: " balance += amount);
     Console.WriteLine("Withdrawal: " balance += amount);
 }
Beispiel #4
0
        public void BalanceTest()
        {
            Account1 a = new Account1();

            Thread t = new Thread(delegate(object o) {
                Account1 b = (Account1)o;
                b.withdraw(10);
            });

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

            int finalBalance = a.read();

            Assert.AreEqual(Account1.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();
                }
            }
            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();
            }
Beispiel #7
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>();
        }
            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();
            }
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result;

            result = MessageBox.Show("Вы действительно хотите удалить этот счёт? При удалении этого счёта все расходы, доходы, переводы и запланированные денежные операции, связанные с этим счётом  также будут удалены .  Удалить счёт?", "Удаление", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                using (FContext db = new FContext())
                {
                    if (AccountGrid.SelectedItems.Count > 0)
                    {
                        for (int i = 0; i < AccountGrid.SelectedItems.Count; i++)
                        {
                            Account1 account = AccountGrid.SelectedItems[i] as Account1;


                            if (account != null)
                            {
                                var item = db.Accounts.Find(account.ID);

                                var table = db.Costs;
                                foreach (var cost in table)
                                {
                                    if (cost.Account == account.ID)
                                    {
                                        db.Costs.Remove(cost);
                                    }
                                }
                                db.SaveChanges();
                                var table1 = db.Incomes;
                                foreach (var income in table1)
                                {
                                    if (income.Account == account.ID)
                                    {
                                        db.Incomes.Remove(income);
                                    }
                                }
                                db.SaveChanges();
                                foreach (var transfer in db.Transfers)
                                {
                                    if ((transfer.Account1 == account.ID) || (transfer.Account2 == account.ID))
                                    {
                                        db.Transfers.Remove(transfer);
                                    }
                                }
                                db.SaveChanges();
                                foreach (var plinc in db.PlaningIncomes)
                                {
                                    if (plinc.Account == account.ID)
                                    {
                                        db.PlaningIncomes.Remove(plinc);
                                    }
                                }
                                db.SaveChanges();
                                foreach (var plc in db.PlaningCosts)
                                {
                                    if (plc.Account == account.ID)
                                    {
                                        db.PlaningCosts.Remove(plc);
                                    }
                                }
                                db.SaveChanges();
                                db.Accounts.Remove(item);
                            }
                        }
                    }
                    db.SaveChanges();
                }
            }
            Refresh();
        }
        public FinanceManager(User users)
        {
            InitializeComponent();

            MainWindow.user = users;

            db        = new FContext();
            user_name = users.NameUser;
            db.Users.Load();
            db.ViewCosts.Load();
            db.ViewIncomes.Load();

            db.PlaningCosts.Load();
            db.Incomes.Load();
            db.Currencies.Load();
            db.Costs.Load();
            db.Accounts.Load();
            db.Transfers.Load();
            string sqlExpression  = "SELECT Costs.Pdate,ViewCosts.ViewCosts, Costs.Amount, Accounts.Name ,Costs.Description, Users.NameUser, Costs.ID FROM Costs left join Accounts On Accounts.ID=Costs.Account left join Users On Accounts.NameUser=Users.ID left join ViewCosts On Costs.Type = ViewCosts.ID Where Users.NameUser='******'";
            string sqlAccount     = " Select Accounts.Name, Accounts.Amount, Currencies.Shortname , ISNULL(d.[Costs],0), ISNULL(b.[Incomes],0), Accounts.Description , Users.NameUser, Accounts.ID  From Accounts full join Users On Accounts.NameUser=Users.ID full join ( Select  sum(Costs.Amount)[Costs], Account  From Costs  group by Account) d  on d.Account=Accounts.ID  left join Currencies on Accounts.Currency=Currencies.ID full join (Select  sum(Incomes.Amount)[Incomes], Account From Incomes  group by Account) b  on b.Account=Accounts.ID Where Users.NameUser='******'";
            string sqlIncome      = "SELECT Incomes.Pdate,ViewIncomes.ViewIncomes, Incomes.Amount, Accounts.Name ,Incomes.Description, Users.NameUser,Incomes.ID FROM Incomes left join Accounts On Accounts.ID=Incomes.Account left join Users On Accounts.NameUser=Users.ID left join ViewIncomes On Incomes.Type = ViewIncomes.ID Where Users.NameUser='******'";
            string sqlTransfer    = "SELECT Transfers.Pdate,ac1.Name,ac2.Name, Transfers.Amount, Users.NameUser, Transfers.ID FROM Transfers left join [Accounts] ac1 ON Transfers.Account1=ac1.ID left join  [Accounts] ac2  on Transfers.Account2=ac2.ID  left join Users On Users.ID=ac2.NameUser AND Users.ID=ac1.NameUser Where Users.NameUser='******'";
            string sqlplaning     = "SELECT PlaningCosts.Pdate,ViewCosts.ViewCosts, PlaningCosts.Amount, Accounts.Name ,PlaningCosts.Description, Users.NameUser, PlaningCosts.ID FROM PlaningCosts left join Accounts On Accounts.ID=PlaningCosts.Account left join Users On Accounts.NameUser=Users.ID left join ViewCosts On PlaningCosts.Type = ViewCosts.ID where Users.NameUser='******'";
            string sqlPlaneIncome = "SELECT PlaningIncomes.Pdate,ViewIncomes.ViewIncomes, PlaningIncomes.Amount, Accounts.Name ,PlaningIncomes.Description, Users.NameUser, PlaningIncomes.ID FROM PlaningIncomes left join Accounts On Accounts.ID = PlaningIncomes.Account left join Users On Accounts.NameUser = Users.ID left join ViewIncomes On PlaningIncomes.Type = ViewIncomes.ID where Users.NameUser = '******'";

            using (SqlConnection sqlconnection1 = new SqlConnection("Data Source = 1-ПК\\SQLSERVER; MultipleActiveResultSets=True; Trusted_Connection = Yes; DataBase = Finances"))
            {
                sqlconnection1.Open();

                SqlCommand    command = new SqlCommand(sqlExpression, sqlconnection1);
                SqlDataReader reader  = command.ExecuteReader();
                List <Cost1>  costs   = new List <Cost1>();


                if (reader.HasRows)
                {
                    try
                    {
                        while (reader.Read())
                        {
                            string pdata = reader.GetDateTime(0).ToShortDateString();
                            Cost1  cost  = new Cost1(pdata, reader.GetString(3), reader.GetString(1), reader.GetDecimal(2), reader.GetString(4), reader.GetInt32(6));
                            costs.Add(cost);
                        }
                        CostsGrid.ItemsSource = costs;
                        CostsStatus.Text      = "Количество записей: " + CostsGrid.Items.Count;
                    }

                    catch { }

                    reader.Close();
                }
                else
                {
                    reader.Close();
                }



                SqlCommand    commandAccount = new SqlCommand(sqlAccount, sqlconnection1);
                SqlDataReader reader1        = commandAccount.ExecuteReader();

                List <Account1> accounts = new List <Account1>();


                if (reader1.HasRows)
                {
                    if (reader1.HasRows)
                    {
                        try
                        {
                            while (reader1.Read())
                            {
                                decimal rest = reader1.GetDecimal(1) - reader1.GetDecimal(3) + reader1.GetDecimal(4);


                                Account1 account = new Account1(reader1.GetString(0), reader1.GetString(2), reader1.GetDecimal(1), rest, reader1.GetString(5), reader1.GetInt32(7));

                                accounts.Add(account);
                            }
                            AccountGrid.ItemsSource = accounts;
                            AccountStatus.Text      = "Количество счетов: " + AccountGrid.Items.Count;
                        }
                        catch { }
                    }

                    reader1.Close();
                }

                SqlCommand     commandIncome = new SqlCommand(sqlIncome, sqlconnection1);
                SqlDataReader  reader2       = commandIncome.ExecuteReader();
                List <Income1> incomes       = new List <Income1>();

                if (reader2.HasRows)
                {
                    try
                    {
                        while (reader2.Read())
                        {
                            string  pdata  = reader2.GetDateTime(0).ToShortDateString();
                            Income1 income = new Income1(pdata, reader2.GetString(3), reader2.GetString(1), reader2.GetDecimal(2), reader2.GetString(4), reader2.GetInt32(6));
                            incomes.Add(income);
                        }
                        IncomeGrid.ItemsSource = incomes;
                        IncomeStatus.Text      = "Количество записей: " + IncomeGrid.Items.Count;
                    }
                    catch { }
                    reader2.Close();
                }

                SqlCommand       commandTransfer = new SqlCommand(sqlTransfer, sqlconnection1);
                SqlDataReader    reader3         = commandTransfer.ExecuteReader();
                List <Transfer1> transfers       = new List <Transfer1>();

                if (reader3.HasRows)
                {
                    try
                    {
                        while (reader3.Read())
                        {
                            string    pdata    = reader3.GetDateTime(0).ToShortDateString();
                            Transfer1 transfer = new Transfer1(pdata, reader3.GetString(1), reader3.GetString(2), reader3.GetDecimal(3), reader3.GetInt32(5));
                            transfers.Add(transfer);
                        }
                        TransfersGrid.ItemsSource = transfers;
                        Status.Text = "Количество записей: " + TransfersGrid.Items.Count;
                    }
                    catch { }
                    reader3.Close();

                    SqlCommand          command3     = new SqlCommand(sqlplaning, sqlconnection1);
                    SqlDataReader       reader6      = command3.ExecuteReader();
                    List <PlaningCost1> planingcosts = new List <PlaningCost1>();

                    if (reader6.HasRows)
                    {
                        try
                        {
                            while (reader6.Read())
                            {
                                string       pdata = reader6.GetDateTime(0).ToShortDateString();
                                PlaningCost1 cost  = new PlaningCost1(pdata, reader6.GetString(3), reader6.GetString(1), reader6.GetDecimal(2), reader6.GetString(4), reader6.GetInt32(6));
                                planingcosts.Add(cost);
                            }
                            CostGrid.ItemsSource = planingcosts;
                            CostStatus.Text      = "Количество записей: " + CostGrid.Items.Count;
                        }
                        catch { }
                        reader6.Close();
                    }


                    SqlCommand            planeIncome = new SqlCommand(sqlPlaneIncome, sqlconnection1);
                    SqlDataReader         reader4     = planeIncome.ExecuteReader();
                    List <PlaningIncome1> incom       = new List <PlaningIncome1>();

                    if (reader4.HasRows)
                    {
                        try
                        {
                            while (reader4.Read())
                            {
                                string         pdata  = reader4.GetDateTime(0).ToShortDateString();
                                PlaningIncome1 income = new PlaningIncome1(pdata, reader4.GetString(3), reader4.GetString(1), reader4.GetDecimal(2), reader4.GetString(4), reader4.GetInt32(6));
                                incom.Add(income);
                            }
                            IncomsGrid.ItemsSource = incom;
                            IncomesStatus.Text     = "Количество записей: " + IncomsGrid.Items.Count;
                        }
                        catch { }
                        reader4.Close();
                    }
                }
            }
        }