private string GetTermosIndexados(GISADataset.FRDBaseRow FRDBaseRow, params TipoNoticiaAut[] TipoNoticiaAut) { StringBuilder Result = new StringBuilder(); ArrayList ResultArray = new ArrayList(); foreach (GISADataset.IndexFRDCARow index in FRDBaseRow.GetIndexFRDCARows()) { if (Array.IndexOf(TipoNoticiaAut, System.Enum.ToObject(typeof(Model.TipoNoticiaAut), index.ControloAutRow.IDTipoNoticiaAut)) >= TipoNoticiaAut.GetLowerBound(0)) { foreach (GISADataset.ControloAutDicionarioRow cadr in index.ControloAutRow.GetControloAutDicionarioRows()) { if (cadr.IDTipoControloAutForma == Convert.ToInt64(TipoControloAutForma.FormaAutorizada)) { ResultArray.Add(cadr.DicionarioRow.Termo); } } } } ResultArray.Sort(); foreach (string s in ResultArray) { if (Result.Length > 0) { Result.Append("\\li128\\par\\li0{}"); } Result.Append(s); } if (Result.Length > 0) { Result.Append("\\li128\\par\\li0{}"); } return Result.ToString(); }
private string GetControloAutFormaAut(GISADataset.FRDBaseRow frd, TipoNoticiaAut[] noticiaAut){ ArrayList Results = new ArrayList(); foreach (GISADataset.IndexFRDCARow idx in frd.GetIndexFRDCARows()) { if (Array.IndexOf(noticiaAut, System.Enum.ToObject(typeof(TipoNoticiaAut), idx.ControloAutRow.IDTipoNoticiaAut)) >= 0) { foreach (GISADataset.ControloAutDicionarioRow cad in idx.ControloAutRow.GetControloAutDicionarioRows()) { if (cad.IDTipoControloAutForma == (long)TipoControloAutForma.FormaAutorizada) { Results.Add(cad.DicionarioRow.Termo); } } } } Results.Sort(); string Result = ""; foreach (string s in Results) { if (Result.Length > 0) Result += " / "; Result += s; } return Result; }
public static bool HasTipologiaChanged(GISADataset.FRDBaseRow frdRow, out string newTip) { newTip = string.Empty; var newTipRow = frdRow.GetIndexFRDCARows().SingleOrDefault(r => r.RowState == DataRowState.Added && r["Selector"] != DBNull.Value && r.Selector == -1); if (newTipRow != null) { newTip = newTipRow.ControloAutRow.GetControloAutDicionarioRows().Single(r => r.IDTipoControloAutForma == (long)TipoControloAutForma.FormaAutorizada).DicionarioRow.Termo; return true; } var remTipRow = GisaDataSetHelper.GetInstance().IndexFRDCA.Cast<GISADataset.IndexFRDCARow>().SingleOrDefault(r => r.RowState == DataRowState.Deleted && System.Convert.ToInt64(r["IDFRDBase", DataRowVersion.Original]) == frdRow.ID && r["Selector", DataRowVersion.Original] != DBNull.Value && System.Convert.ToInt64(r["Selector", DataRowVersion.Original]) == -1); if (remTipRow != null) { newTip = null; return true; } return false; }
public static List<string> HasIndexacaoChanged(GISADataset.FRDBaseRow frdRow) { var newIdxRows = frdRow.GetIndexFRDCARows().Where(r => r.RowState == DataRowState.Added && (r.ControloAutRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.Ideografico || r.ControloAutRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.Onomastico || r.ControloAutRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.ToponimicoGeografico)); if (newIdxRows.Count() > 0) return newIdxRows.Where(r => r.ControloAutRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.Ideografico || r.ControloAutRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.Onomastico || r.ControloAutRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.ToponimicoGeografico).Select(r => r.ControloAutRow.GetControloAutDicionarioRows().Single(cad => cad.IDTipoControloAutForma == (long)TipoControloAutForma.FormaAutorizada).DicionarioRow.Termo).ToList(); var remIdxRows = GisaDataSetHelper.GetInstance().IndexFRDCA.Cast<GISADataset.IndexFRDCARow>().Where(r => r.RowState == DataRowState.Deleted && (long)r["IDFRDBase", DataRowVersion.Original] == frdRow.ID); foreach (var idx in remIdxRows) { var res = new List<string>(); var caRow = GisaDataSetHelper.GetInstance().ControloAut.Cast<GISADataset.ControloAutRow>().Single(r => r.ID == (long)idx["IDControloAut", DataRowVersion.Original]); if (caRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.Ideografico || caRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.Onomastico || caRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.ToponimicoGeografico) res.Add(caRow.GetControloAutDicionarioRows().Single(r => r.IDTipoControloAutForma == 1).DicionarioRow.Termo); return res; } return null; }
//metodo responsavel por eliminar toda a nuvem do CA actual em memoria public static PersistencyHelper.DeleteCAXPreConcArguments DeleteCAX(GISADataset.ControloAutRow caRow) { GISADataset.ControloAutDicionarioRow[] cadRows = caRow.GetControloAutDicionarioRows(); GISADataset.DicionarioRow dRow = null; PersistencyHelper.DeleteCAXPreConcArguments args = new PersistencyHelper.DeleteCAXPreConcArguments(); // eliminar registos de "Dicionario" e de "ControloAutDicionario" cadRows.ToList().ForEach(cadRow => { dRow = cadRow.DicionarioRow; args.termos.Add(dRow); cadRow.Delete(); }); args.caRowID = caRow.ID; args.catCode = getCatCode(caRow.TipoNoticiaAutRow); // eliminar registos de IndexFRDCA caRow.GetIndexFRDCARows().ToList().ForEach(idx => idx.Delete()); // Somente para notícias de autoridade relacionaveis caRow.GetControloAutRelRowsByControloAutControloAutRel().ToList().ForEach(carRow => carRow.Delete()); caRow.GetControloAutRelRowsByControloAutControloAutRelAlias().ToList().ForEach(carRow => carRow.Delete()); caRow.GetControloAutEntidadeProdutoraRows().ToList().ForEach(caepRow => caepRow.Delete()); caRow.GetControloAutDatasExistenciaRows().ToList().ForEach(cadeRow => cadeRow.Delete()); caRow.Delete(); return args; }