コード例 #1
0
        private void UpdateCustomersButton_OnClick(object sender, RoutedEventArgs e)
        {
            IList selectedCustomers = CustomersDataGrid.SelectedItems;
            int   customersSize     = selectedCustomers.Count;

            for (var i = 0; i < customersSize; i++)
            {
                DataRowView row    = (DataRowView)CustomersDataGrid.SelectedItems[i];
                string      textId = row["Id"].ToString();
                int         id     = Convert.ToInt32(textId);

                Client client = _client.FindCustomerById(id);
                client.Nume       = row["Nume"].ToString();
                client.Prenume    = row["Prenume"].ToString();
                client.Adresa     = row["Adresa"].ToString();
                client.Localitate = row["Localitate"].ToString();
                client.Judet      = row["Judet"].ToString();
                client.Telefon    = row["Telefon"].ToString();
                client.Email      = row["Email"].ToString();

                _client.UpdateClient(client);
            }

            CustomersTabItem_OnLoaded(sender, e);
        }