Exemple #1
0
        public void LoadData(GISADataset.FRDBaseRow FRDBase, IDbConnection conn)
        {
            this.CurrentFRDBase = FRDBase;

            FRDRule.Current.LoadDadosLicencasDeObras(GisaDataSetHelper.GetInstance(), CurrentFRDBase.ID, conn);
            var modRows = GisaDataSetHelper.GetInstance().IndexFRDCA.Cast <GISADataset.IndexFRDCARow>().Where(r => r.RowState != DataRowState.Unchanged).ToList();

            if (modRows.Count == 0)
            {
                FRDRule.Current.LoadConteudoEEstrutura(GisaDataSetHelper.GetInstance(), CurrentFRDBase.ID, conn);
            }

            var licenca = GisaDataSetHelper.GetInstance().LicencaObra.Cast <GISADataset.LicencaObraRow>().Where(r => r.IDFRDBase == CurrentFRDBase.ID).SingleOrDefault();

            var tipoTipLicencaObra = GisaDataSetHelper.GetInstance().TipoTipologias.Cast <GISADataset.TipoTipologiasRow>().Single(r => r.BuiltInName.Equals("PROCESSO_DE_OBRAS"));
            var caLicencaObra      = GisaDataSetHelper.GetInstance().IndexFRDCA.Cast <GISADataset.IndexFRDCARow>()
                                     .Where(idx => idx.RowState != DataRowState.Deleted && idx.IDFRDBase == CurrentFRDBase.ID && idx["Selector"] != DBNull.Value && idx.Selector == -1)
                                     .Select(idx => idx.ControloAutRow).SingleOrDefault(ca => ca.IDTipoNoticiaAut == (long)TipoNoticiaAut.TipologiaInformacional && ca.TipoTipologiasRow == tipoTipLicencaObra);

            if (licenca == null && caLicencaObra != null)
            {
                licenca                       = GisaDataSetHelper.GetInstance().LicencaObra.NewLicencaObraRow();
                licenca.FRDBaseRow            = CurrentFRDBase;
                licenca.TipoObra              = string.Empty;
                licenca.PropriedadeHorizontal = false;
                licenca.PHTexto               = string.Empty;
                licenca.Versao                = new byte[] { };
                licenca.isDeleted             = 0;
                GisaDataSetHelper.GetInstance().LicencaObra.AddLicencaObraRow(licenca);
            }

            CurrentLicencaObra = licenca;
        }
        public void LoadData(GISADataset.FRDBaseRow FRDBase, IDbConnection conn) {
            this.CurrentFRDBase = FRDBase;

            var nivelUpper = this.CurrentFRDBase.NivelRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica().Single().NivelRowByNivelRelacaoHierarquicaUpper;
            var frdUpper = nivelUpper.GetFRDBaseRows().Single();

            FRDRule.Current.LoadDadosLicencasDeObras(GisaDataSetHelper.GetInstance(), CurrentFRDBase.ID, conn);
            FRDRule.Current.LoadDadosLicencasDeObras(GisaDataSetHelper.GetInstance(), frdUpper.ID, conn);
            var modRows = GisaDataSetHelper.GetInstance().IndexFRDCA.Cast<GISADataset.IndexFRDCARow>().Where(r => r.RowState != DataRowState.Unchanged).ToList();
            if (modRows.Count == 0)
            {
                FRDRule.Current.LoadConteudoEEstrutura(GisaDataSetHelper.GetInstance(), CurrentFRDBase.ID, conn);
                FRDRule.Current.LoadConteudoEEstrutura(GisaDataSetHelper.GetInstance(), frdUpper.ID, conn);
            }

            var licenca = GisaDataSetHelper.GetInstance().LicencaObra.Cast<GISADataset.LicencaObraRow>().Where(r => r.IDFRDBase == CurrentFRDBase.ID).SingleOrDefault();

            var tipoTipLicencaObra = GisaDataSetHelper.GetInstance().TipoTipologias.Cast<GISADataset.TipoTipologiasRow>().Single(r => r.BuiltInName.Equals("PROCESSO_DE_OBRAS"));
            var caLicencaObra = GisaDataSetHelper.GetInstance().IndexFRDCA.Cast<GISADataset.IndexFRDCARow>()
                .Where(idx => idx.RowState != DataRowState.Deleted && idx.IDFRDBase == frdUpper.ID && idx["Selector"] != DBNull.Value && idx.Selector == -1)
                .Select(idx => idx.ControloAutRow).SingleOrDefault(ca => ca.IDTipoNoticiaAut == (long)TipoNoticiaAut.TipologiaInformacional && ca.TipoTipologiasRow == tipoTipLicencaObra);

            if (licenca == null && caLicencaObra != null)
            {
                licenca = GisaDataSetHelper.GetInstance().LicencaObra.NewLicencaObraRow();
                licenca.FRDBaseRow = CurrentFRDBase;
                licenca.TipoObra = string.Empty;
                licenca.PropriedadeHorizontal = false;
                licenca.PHTexto = string.Empty;
                licenca.Versao = new byte[] { };
                licenca.isDeleted = 0;
                GisaDataSetHelper.GetInstance().LicencaObra.AddLicencaObraRow(licenca);
            }

            CurrentLicencaObra = licenca;
        }