Exemple #1
0
        private void GridUtenti_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            var grid = sender as DataGrid;

            if (e != null && e.AddedCells != null && e.AddedCells.Count > 0 && e.AddedCells[0] != null && e.AddedCells[6] != null && e.AddedCells[6].Item != null)
            {
                UtenteGriglia item = (UtenteGriglia)e.AddedCells[6].Item;
                if (item.ReadOnly)
                {
                    //if (e != null && e.AddedCells[0] != null)
                    //{
                    //grid.BeginEdit();
                    e.AddedCells[0].Column.IsReadOnly = true;
                    //grid.CommitEdit();
                    //}
                }
                else
                {
                    e.AddedCells[0].Column.IsReadOnly = false;
                }
            }
        }
Exemple #2
0
        private void btnSalva_Click(object sender, RoutedEventArgs e)
        {
            // si salvano i dati del team
            // se il team non esiste si crea altrimenti si aggiorna

            string listaUtenti = "";

            foreach (var data in GridUtenti.Items)
            {
                UtenteGriglia utente = data as UtenteGriglia;
                if (utente.InTeam && !utente.ReadOnly)
                {
                    if (!string.IsNullOrEmpty(listaUtenti))
                    {
                        listaUtenti += ",";
                    }
                    listaUtenti += utente.Id;
                }
            }
            cUtenti.UpsertTeam(_teamList[cmbTeamLeader.SelectedIndex].Id, listaUtenti);

            MessageBox.Show("Salvataggio avvenuto con successo", "Salvataggio dati", MessageBoxButton.OK, MessageBoxImage.Information);
            //base.Close();
        }