protected override void UpdateListViewItem(ListViewItem li, GISADataset.TrusteeRow t) { base.UpdateListViewItem(li, t); //TODO: if(! (t.GetTrusteeUserRows()[0].IsFullNameNull())) if (t.GetTrusteeUserRows().Length > 0 && !(t.GetTrusteeUserRows()[0].IsFullNameNull())) li.SubItems[ColumnHeaderFullName.Index].Text = t.GetTrusteeUserRows()[0].FullName; else li.SubItems[ColumnHeaderFullName.Index].Text = ""; }
public static void DeleteTrusteeAndRelatedRows(GISADataset.TrusteeRow truRow) { GISADataset.TrusteeGroupRow[] grpRows = truRow.GetTrusteeGroupRows(); GISADataset.TrusteeUserRow[] usrRows = truRow.GetTrusteeUserRows(); GISADataset.UserGroupsRow[] ugRows = null; List<long> UserIDs = new List<long>(); if (grpRows.Length > 0) { ugRows = grpRows[0].GetUserGroupsRows(); foreach (GISADataset.UserGroupsRow ugRow in ugRows) UserIDs.Add(ugRow.IDUser); } else if (usrRows.Length > 0) ugRows = usrRows[0].GetUserGroupsRows(); GISADataset.TrusteePrivilegeRow[] tpRows = (GISADataset.TrusteePrivilegeRow[])(GisaDataSetHelper.GetInstance().TrusteePrivilege.Select(string.Format("IDTrustee={0}", truRow.ID))); foreach (GISADataset.TrusteePrivilegeRow tpRow in tpRows) tpRow.Delete(); if (ugRows != null) foreach (GISADataset.UserGroupsRow ugRow in ugRows) ugRow.Delete(); foreach (GISADataset.TrusteeGroupRow grpRow in grpRows) grpRow.Delete(); foreach (GISADataset.TrusteeUserRow usrRow in usrRows) { foreach (GISADataset.TrusteeUserRow uRowAuth in usrRow.GetTrusteeUserRows()) uRowAuth.SetIDTrusteeUserDefaultAuthorityNull(); usrRow.Delete(); } truRow.Delete(); try { PersistencyHelper.save(); PersistencyHelper.cleanDeletedData(); } catch (Exception ex) { Trace.WriteLine(ex); throw; } }