Example #1
0
        private void GarageComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var user = AllUserData.GetSelectedUser(garageComboBox.SelectedItem.ToString());

            nameLabel.Text    = "Name: " + user.Name;
            surnameLabel.Text = "Surname: " + user.Surname;
        }
Example #2
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();
        }
Example #3
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++;
            }
        }
Example #4
0
 private void AddCardButton_Click(object sender, EventArgs e)
 {
     try
     {
         var user = AllUserData.GetSelectedUser(garageComboBox.SelectedItem.ToString());
         AddUser.AddCardToUser(user, CardTextBox.Text);
         DialogResult result = MessageBox.Show("Успех!", "Успех!", MessageBoxButtons.OK);
         if (result == DialogResult.OK)
         {
             Close();
         }
     }
     catch (Exception)
     {
         DialogResult result = MessageBox.Show("Ошибка!", "Ошибка!", MessageBoxButtons.OK);
     }
 }
Example #5
0
 private void makePaymentButton_Click(object sender, EventArgs e)
 {
     try
     {
         var user = AllUserData.GetSelectedUser(garageComboBox.SelectedItem.ToString());
         BussinesLogic.Payment.Pay(user, Convert.ToDouble(payTextBox.Text));
         DialogResult result = MessageBox.Show("Успех!", "Успех!", MessageBoxButtons.OK);
         if (result == DialogResult.OK)
         {
             Close();
         }
     }
     catch (Exception)
     {
         DialogResult result = MessageBox.Show("Ошибка!", "Ошибка!", MessageBoxButtons.OK);
     }
     finally
     {
         GetUserInfo();
     }
 }
Example #6
0
        private void garageComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var user = AllUserData.GetSelectedUser(garageComboBox.SelectedItem.ToString());

            nameLabel.Text    = user.Name;
            surnameLabel.Text = user.Surname;

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

            entrancesDataGrid.Rows.Clear();
            int 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++;
            }
        }
Example #7
0
 public User GetUserByGarage(string id) => AllUserData.GetSelectedUser(id);
 public ActionResult GetInfo(string cardnumber)
 {
     return(View(AllUserData.GetSelectedUser(cardnumber)));
 }