Exemplo n.º 1
0
        private void GetUserInfo()
        {
            var user = AllUserData.GetSelectedUser(garageComboBox.SelectedItem.ToString());

            nameLabel.Text    = user.Name;
            surnameLabel.Text = user.Surname;
            moneyLabel.Text   = CheckACar.GetCarStatus(Convert.ToInt32(garageComboBox.SelectedItem)).ToString();
        }
Exemplo n.º 2
0
        private void GetUserInfo()
        {
            var user = AllUserData.GetSelectedUser(garageComboBox.SelectedItem.ToString());

            nameTextBox.Text     = user.Name;
            surnameTextBox.Text  = user.Surname;
            balanceTextBox.Text  = CheckACar.GetCarStatus(Convert.ToInt32(garageComboBox.SelectedItem)).ToString();
            phoneTextBox.Text    = user.Phone;
            birthdayTextBox.Text = user.Birthday.ToShortDateString();

            string userStatus;

            if (user.InGarage)
            {
                userStatus = "В гараже";
            }
            else
            {
                userStatus = "Вне гаража";
            }
            statusTextBox.Text = userStatus;

            paymentsGridView.Rows.Clear();
            int i = 0;

            foreach (var payment in user.Payments)
            {
                paymentsGridView.Rows.Add();
                paymentsGridView.Rows[i].Cells[0].Value = payment.DateTime.Date.ToShortDateString();
                paymentsGridView.Rows[i].Cells[1].Value = payment.Sum;
                i++;
            }

            i = 0;
            cardsGridView.Rows.Clear();
            foreach (var card in user.Cards)
            {
                cardsGridView.Rows.Add();
                cardsGridView.Rows[i].Cells[0].Value = card.CardId;
                i++;
            }

            var dates = user.Entrances
                        .Select(en => en.EntranceDate)
                        .GroupBy(dt => dt)
                        .ToList()
            ;

            entrancesDataGrid.Rows.Clear();
            i = 0;
            foreach (var entrance in dates)
            {
                entrancesDataGrid.Rows.Add();
                entrancesDataGrid.Rows[i].Cells[0].Value = entrance.Key.Date.ToShortDateString();
                entrancesDataGrid.Rows[i].Cells[1].Value = entrance.Count();
                i++;
            }
        }