Ejemplo n.º 1
0
        public TransferWindow()
        {
            InitializeComponent();
            AccountGrid.AutoGenerateColumns = false;
            AccountGrid.ItemsSource         = SourseAccount;

            //SQLFunctionscs.OpenConnection(MainWindow.ParentWindow.Bullder, "SELECT CU.CurrencySign FROM CURRENCY AS CU;", SQLFunctionscs.ComboBoxAdd, CurrencyBox);
            SQLFunctionscs.OpenConnection(MainWindow.ParentWindow.Bullder, $"SELECT AccountCode FROM ACCOUNT WHERE ClientID = {MainWindow.ParentWindow.IDCode}", SQLFunctionscs.ComboBoxAdd, FromAccountBox);
            SQLFunctionscs.OpenConnection(MainWindow.ParentWindow.Bullder, $"SELECT AccountCode FROM ACCOUNT WHERE ClientID = {MainWindow.ParentWindow.IDCode}", SQLFunctionscs.ComboBoxAdd, ToAccountBox);
            SQLFunctionscs.OpenConnection(MainWindow.ParentWindow.Bullder, $"SELECT * FROM dbo.ShowAccounts({MainWindow.ParentWindow.IDCode});", SQLFunctionscs.CollectionAdd, SourseAccount);

            using (var Connection = new SqlConnection(MainWindow.ParentWindow.Bullder.ConnectionString))
            {
                Connection.Open();
                using (var Command = new SqlCommand("SELECT CU.CurrencySign, Cu.CurrencyID FROM CURRENCY AS CU;", Connection))
                {
                    var Reader = Command.ExecuteReader();
                    while (Reader.Read())
                    {
                        CurrencyDict[Reader.GetString(0)] = Reader.GetInt32(1);
                    }
                }
            }
            CurrencyBox.ItemsSource = CurrencyDict.Keys;
        }
Ejemplo n.º 2
0
 private void OpenAccountButton_Click(object sender, RoutedEventArgs e)
 {
     SQLFunctionscs.ConectionFunc(
         MainWindow.ParentWindow.Bullder, $"INSERT INTO ACCOUNT(AccountCode, ClientID, CurrencyID, MoneyValue)" +
         $" VALUES({AccountInputCodebox.Text},{MainWindow.ParentWindow.IDCode},{CurrencyDict[CurrencyBox.SelectedItem.ToString()]}, 0);");
     SourseAccount.Clear();
     SQLFunctionscs.OpenConnection(MainWindow.ParentWindow.Bullder, $"SELECT * FROM dbo.ShowAccounts({MainWindow.ParentWindow.IDCode});", SQLFunctionscs.CollectionAdd, SourseAccount);
 }
Ejemplo n.º 3
0
        private void DepositButton_Click(object sender, RoutedEventArgs e)
        {
            var paramDict = new Dictionary <string, string>
            {
                ["@Value"]       = MoneyValueBox.Text,
                ["@AccountCode"] = FromAccountBox.SelectedItem.ToString(),
                ["@CurrencyID"]  = CurrencyDict[CurrencyBox.SelectedItem.ToString()].ToString()
            };

            SQLFunctionscs.SQLStoredProcedure(MainWindow.ParentWindow.Bullder, "dbo.depositMoney", paramDict);
            SourseAccount.Clear();
            SQLFunctionscs.OpenConnection(MainWindow.ParentWindow.Bullder, $"SELECT * FROM dbo.ShowAccounts({MainWindow.ParentWindow.IDCode});", SQLFunctionscs.CollectionAdd, SourseAccount);
        }
Ejemplo n.º 4
0
 private void CloseAccountButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         SQLFunctionscs.ConectionFunc(MainWindow.ParentWindow.Bullder, $"DELETE FROM ACCOUNT WHERE AccountCode = '{AccountGrid.SelectedItem.ToString()}'");
         SourseAccount.Clear();
         SQLFunctionscs.OpenConnection(MainWindow.ParentWindow.Bullder, $"SELECT * FROM dbo.ShowAccounts({MainWindow.ParentWindow.IDCode});", SQLFunctionscs.CollectionAdd, SourseAccount);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 5
0
 public static void UseTransferMoney(ObservableCollection <ClientAccount> SourseCollection, string Value, string FromAccount, string ToAccount)
 {
     using (var Connection = new SqlConnection(MainWindow.ParentWindow.Bullder.ConnectionString))
     {
         Connection.Open();
         using (var Command = new SqlCommand("dbo.TransferMoney", Connection))
         {
             Command.CommandType = CommandType.StoredProcedure;
             Command.Parameters.Add(new SqlParameter("@Value", Value));
             Command.Parameters.Add(new SqlParameter("@fromCode", FromAccount));
             Command.Parameters.Add(new SqlParameter("@ToCode", ToAccount));
             Command.ExecuteNonQuery();
         }
     }
     SourseCollection.Clear();
     SQLFunctionscs.OpenConnection(MainWindow.ParentWindow.Bullder, $"SELECT * FROM dbo.ShowAccounts({MainWindow.ParentWindow.IDCode});", SQLFunctionscs.CollectionAdd, SourseCollection);
 }
Ejemplo n.º 6
0
 private void CodeTransferButton_Click(object sender, RoutedEventArgs e)
 {
     SQLFunctionscs.UseTransferMoney(SourseAccount, MoneyValueBox.Text, FromAccountBox.SelectedItem.ToString(), AccountCodeBox.Text);
 }