Пример #1
0
        private void UpdateRecipientLabelContent()
        {
            Bill     bill               = (Bill)RecipientList.SelectedItem;
            Customer customer           = UsersORM.GetCustomerByGuid(bill.CustomerId);
            int      updatedBillBalance = BillORM.GetBillbyBillNumber(bill.BillNumber).Balance;

            RecipientLabel.Content = String.Format("Recipient: {0} {1} \nBalance: {2:n} Kč", customer.Name, customer.SurName, updatedBillBalance);
        }
Пример #2
0
        // Products overview
        private void ViewProductDetails_Click(object sender, RoutedEventArgs e)
        {
            Button        b             = sender as Button;
            Bill          bill          = BillORM.GetBillbyBillNumber((int)b.CommandParameter);
            ProductWindow productWindow = new ProductWindow(activeOfficial, bill);

            productWindow.Show();
            Close();
        }
Пример #3
0
 public SecretWindow(Official official)
 {
     InitializeComponent();
     PayerList.ItemsSource     = BillORM.GetBills();
     RecipientList.ItemsSource = BillORM.GetBills();
     random = new Random();
     GenerateNewVariableSymbol();
     GenerateNewAmount();
     Official         = official;
     LastTransactions = new List <Transaction>();
     GenerateLastTransactions();
 }
Пример #4
0
        private void CreateTransactionButton_Click(object sender, RoutedEventArgs e)
        {
            Bill payer     = (Bill)PayerList.SelectedItem;
            Bill recipient = (Bill)RecipientList.SelectedItem;

            CreateTransactionLabel.Content = "";

            if (PayerList.SelectedItem is null || RecipientList.SelectedItem is null)
            {
                CreateTransactionLabel.Content = "You have to select \none Payer and one Recipient";
                return;
            }

            if (payer.BillNumber == recipient.BillNumber)
            {
                CreateTransactionLabel.Content = "Unable create Transaction \nbecause Payer = Recipient";
                return;
            }

            Transaction newTransaction = new Transaction
            {
                Id               = TransactionORM.GetNewTransactionId(),
                VariableSymbol   = Int32.Parse(VariableSymbolTextBox.Text),
                Amount           = Int32.Parse(AmountTextBox.Text),
                Valid            = true,
                PayerBillNum     = payer.BillNumber,
                RecipientBillNum = recipient.BillNumber,
                DateTransaction  = DateTime.Now
            };

            DateTime?selectedDate = DateSelectionBox.SelectedDate;

            if (selectedDate.HasValue)
            {
                newTransaction.DateTransaction = (DateTime)DateSelectionBox.SelectedDate;
            }

            TransactionORM.CreateNewTransaction(newTransaction);
            BillORM.UpdateBillBalance(newTransaction);

            UpdatePayerLabelContent();
            UpdateRecipientLabelContent();
            GenerateNewVariableSymbol();
            GenerateNewAmount();

            UpdateLastTransactionsList(newTransaction);
        }
Пример #5
0
        public void OpenDetailViewOfUser(Customer customer)
        {
            SetDefaultSettings();
            foreach (Control c in userControlsList)
            {
                c.Visibility = Visibility.Visible;
                c.IsEnabled  = false;
            }
            OfficialSubTypeComboBox.Visibility = Visibility.Hidden;

            foreach (Control c in addressControlsList)
            {
                c.Visibility = Visibility.Visible;
                c.IsEnabled  = false;
            }

            MainPageLabel.Content     = "CUSTOMER DETAILS:";
            MainPageLabel.IsEnabled   = true;
            EditModeButton.Visibility = Visibility.Visible;
            StornoButton.Visibility   = Visibility.Visible;
            LoginLabel.Content        = "SSN";


            tempCustomer = UsersORM.GetCustomerBySSN(customer.SSN);

            NameTextBox.Text    = customer.Name;
            SurnameTextBox.Text = customer.SurName;
            PhoneTextBox.Text   = customer.Phone;
            EmailTextBox.Text   = customer.Mail;

            Address address = UsersORM.SelectAddressById(customer.Address.Id);

            customer.Address = address;

            StreetTextBox.Text       = customer.Address.Street;
            StreetNumberTextBox.Text = customer.Address.StreetNumber;
            CityTextBox.Text         = customer.Address.City;
            PostalCodeTextBox.Text   = customer.Address.PostalCode;
            CountryTextBox.Text      = customer.Address.Country;
            LoginTextBox.Text        = customer.SSN;
            UserTypeComboBox.Text    = "Customer";

            switch (customer.CustomerType)
            {
            case CustomerType.Person:
                CustomerSubTypeComboBox.SelectedItem = CustomerSubTypeComboBox_Person;
                break;

            case CustomerType.Company:
                CustomerSubTypeComboBox.SelectedItem = CustomerSubTypeComboBox_Company;
                break;
            }

            switch (customer.Valid)
            {
            case true:
                ValidTextBox.Text = "Yes";
                break;

            case false:
                ValidTextBox.Text = "No";
                break;
            }


            AllProductsListView.Visibility  = Visibility.Visible;
            ListOfProductsLabel.Visibility  = Visibility.Visible;
            AllProductsListView.ItemsSource = BillORM.GetBillsByCustomerId(customer);
        }