예제 #1
0
 internal Correspondencia(EntidadeExterna ee, EntidadeInterna ei, TipoSugestao tipoSugestao)
 {
     this.TipoOpcao       = TipoOpcao.Sugerida; //assume-se correspondencias instanciadas são sempre sugestões
     this.TipoSugestao    = tipoSugestao;
     this.EntidadeExterna = ee;
     this.mEscolhasEntidadesInternas[TipoOpcao.Sugerida] = ei;
 }
예제 #2
0
        void BrowseEntidadeInterna(FormSelectNivel form, ref EntidadeInterna ei, out bool cancel, List<long> tnrLst)
        {
            cancel = false;

            switch (form.ShowDialog())
            {
                case DialogResult.OK:
                    var documento = new DocumentoGisa();
                    if (tnrLst.Contains((long)TipoNivelRelacionado.SD))
                        documento.CopyProperties(this.correspDocumento);
                    documento.Titulo = form.SelectedDocument.GetNivelDesignadoRows()[0].Designacao;
                    documento.Codigo = form.SelectedDocument.Codigo;
                    documento.Tipo = TipoEntidade.GetTipoEntidadeInterna(form.SelectedDocument.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].IDTipoNivelRelacionado);
                    ei = documento;
                    ei.Estado = TipoEstado.SemAlteracoes;
                    ei.Id = form.SelectedDocument.ID;
                    break;
                case DialogResult.Cancel:
                    cancel = true;
                    break;
            }
        }
예제 #3
0
        void BrowseEntidadeDocumentos(object sender, ref EntidadeInterna ei, out bool cancel, List<long> tnrLst)
        {
            cancel = false;
            FormSelectNivel form = new FormSelectNivel();
            form.SelectableType = tnrLst;
            form.nivelNavigator1.LoadVistaEstrutural();

            BrowseEntidadeInterna(form, ref ei, out cancel, tnrLst);
        }
예제 #4
0
        void BrowseEntidadeSeries(object sender, ref EntidadeInterna ei, out bool cancel, List<long> tnrLst, long produtorID)
        {
            cancel = false;
            FormSelectNivel form = new FormSelectNivel();
            form.SelectableType = tnrLst;
            form.SetOnlyDocViewMode(produtorID);

            BrowseEntidadeInterna(form, ref ei, out cancel, tnrLst);
        }
예제 #5
0
 void SuggestionPickerDocumento_BrowseEntidadeInterna(object sender, ref EntidadeInterna ei, TipoEntidadeExterna tee, out bool cancel, out TipoEstado estado)
 {
     estado = TipoEstado.SemAlteracoes;
     BrowseEntidadeDocumentos(sender, ref ei, out cancel, new List<long>() { TipoNivelRelacionado.SD });
     if (!cancel)
     {
         txtID.Text = ei.Id.ToString();
         Database.Database.LoadDocumentDetails(ei);
     }
 }
예제 #6
0
        void SuggestionPickerRA_BrowseEntidadeInterna(object sender, ref EntidadeInterna ei, TipoEntidadeExterna tee, out bool cancel, out TipoEstado estado)
        {
            estado = TipoEstado.Novo;
            cancel = false;
            var rai = (RegistoAutoridadeInterno)ei;
            var tna = TipoEntidade.GetTipoNoticiaAut(tee);
            FormPickControloAut frmPick = new FormPickControloAut();
            frmPick.Text = "Notícia de autoridade - Pesquisar registo de autoridade";
            frmPick.caList.AllowedNoticiaAut(tna);
            frmPick.caList.ReloadList();

            if (frmPick.caList.Items.Count > 0)
                frmPick.caList.SelectItem(frmPick.caList.Items[0]);

            switch (frmPick.ShowDialog())
            {
                case DialogResult.OK:
                    var cadRow = (GISADataset.ControloAutDicionarioRow)frmPick.caList.SelectedItems[0].Tag;
                    switch (tna)
                    {
                        case TipoNoticiaAut.EntidadeProdutora:
                            var produtor = new Model.EntidadesInternas.Produtor();
                            var nRowCA = cadRow.ControloAutRow.GetNivelControloAutRows()[0].NivelRow;
                            produtor.Codigo = nRowCA.Codigo;
                            rai = produtor;
                            estado = Database.Database.IsProdutor(this.correspDocumento.EntidadeInterna.Id, nRowCA.ID) ? TipoEstado.SemAlteracoes : TipoEstado.Novo;
                            break;
                        case TipoNoticiaAut.Onomastico:
                            rai = new Model.EntidadesInternas.Onomastico();
                            estado = TipoEstado.Novo;
                            break;
                        case TipoNoticiaAut.Ideografico:
                            rai = new Model.EntidadesInternas.Ideografico();
                            estado = TipoEstado.Novo;
                            break;
                        case TipoNoticiaAut.ToponimicoGeografico:
                            rai = new Model.EntidadesInternas.Geografico();
                            estado = TipoEstado.Novo;
                            break;
                        case TipoNoticiaAut.TipologiaInformacional:
                            rai = new Model.EntidadesInternas.Tipologia();
                            if (this.Documento.Id > 0)
                            {
                                var nRow = GisaDataSetHelper.GetInstance().Nivel.Cast<GISADataset.NivelRow>().Single(r => r.ID == this.Documento.Id);
                                if (GisaDataSetHelper.GetInstance().IndexFRDCA.Cast<GISADataset.IndexFRDCARow>().SingleOrDefault(r => r.IDControloAut == cadRow.IDControloAut && r.IDFRDBase == nRow.GetFRDBaseRows()[0].ID) != null)
                                    estado = TipoEstado.SemAlteracoes;
                                else if (nRow.GetFRDBaseRows()[0].GetIndexFRDCARows().Select(r => r.ControloAutRow).Count(caRow => caRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.TipologiaInformacional) > 0)
                                    estado = TipoEstado.Editar;
                                else
                                    estado = TipoEstado.Novo;
                            }
                            break;
                    }
                    rai.Titulo = cadRow.DicionarioRow.Termo;
                    rai.Estado = TipoEstado.SemAlteracoes;
                    rai.Id = cadRow.IDControloAut;
                    ei = rai;
                    break;
                case DialogResult.Cancel:
                    cancel = true;
                    break;
            }
        }
예제 #7
0
 private bool CreateDocumentoInterno(ref EntidadeInterna ei, long tnr)
 {
     bool cancel = false;
     FormAddNivel form = new FormAddNivel();
     form.IDTipoNivelRelacionado = tnr;
     if (ei != null)
     {
         form.txtDesignacao.Text = ei != null ? ((DocumentoGisa)ei).Titulo : "";
         if (tnr == TipoNivelRelacionado.SD)
             form.txtCodigo.Text = ei != null ? ((DocumentoGisa)ei).Codigo : "";
     }
     switch (form.ShowDialog())
     {
         case DialogResult.OK:
             var documento = new DocumentoGisa();
             documento.Tipo = tnr == (long)TipoNivelRelacionado.SD ? TipoEntidadeInterna.DocumentoSimples : TipoEntidadeInterna.DocumentoComposto;
             if (tnr == (long)TipoNivelRelacionado.SD)
                 documento.CopyProperties(this.correspDocumento);
             documento.Titulo = form.txtDesignacao.Text;
             documento.Codigo = form.txtCodigo.Text;
             ei = this.InternalEntitiesLst.AddInternalEntity(documento);
             break;
         case DialogResult.Cancel:
             cancel = true;
             break;
     }
     return cancel;
 }
예제 #8
0
 void SuggestionPickerDocumento_CreateEntidadeInterna(object sender, ref EntidadeInterna ei, TipoEntidadeExterna tee, out bool cancel, out TipoEstado estado)
 {
     estado = TipoEstado.Novo;
     cancel = CreateDocumentoInterno(ref ei, TipoNivelRelacionado.SD);
     if (!cancel)
     {
         txtID.Text = "Não atribuido";
         if (this.correspDocumento.EntidadeInterna != null) // se for igual a null quer dizer que não há nenhum documento selecionado
         {
             var dg = this.correspDocumento.EntidadeInterna as DocumentoGisa;
             dg.Processo.EstadoRelacaoPorOpcao[TipoOpcao.Trocada] = estado;
         }
     }
 }
예제 #9
0
        void SuggestionPickerRA_CreateEntidadeInterna(object sender, ref EntidadeInterna ei, TipoEntidadeExterna tee, out bool cancel, out TipoEstado estado)
        {
            estado = TipoEstado.Novo;
            cancel = false;
            FormCreateControloAut form = null;
            var rai = (RegistoAutoridadeInterno)ei;
            var tna = TipoEntidade.GetTipoNoticiaAut(tee);
            if (tna == TipoNoticiaAut.EntidadeProdutora)
                form = new FormCreateEntidadeProdutora();
            else
                form = new FormCreateControloAut();

            if (tna == TipoNoticiaAut.Onomastico)
            {
                form.SetOptionalControlsVisible(true);
                form.NIF = ei != null ? ((Model.EntidadesInternas.Onomastico)ei).Codigo : "";
            }

            GISADataset.TipoNoticiaAutRow allNoticiaAut = null;
            allNoticiaAut = GisaDataSetHelper.GetInstance().TipoNoticiaAut.NewTipoNoticiaAutRow();
            allNoticiaAut.ID = -1;
            allNoticiaAut.Designacao = "<Todos>";

            List<GISADataset.TipoNoticiaAutRow> rows = new List<GISADataset.TipoNoticiaAutRow>();
            rows.Add(allNoticiaAut);
            rows.AddRange(GisaDataSetHelper.GetInstance().TipoNoticiaAut.Cast<GISADataset.TipoNoticiaAutRow>().Where(r => r.ID == (long)tna));

            form.cbNoticiaAut.BeginUpdate();
            form.cbNoticiaAut.DataSource = rows;
            form.cbNoticiaAut.DisplayMember = "Designacao";
            form.cbNoticiaAut.EndUpdate();
            if (form.cbNoticiaAut.Items.Count == 2)
            {
                form.cbNoticiaAut.SelectedIndex = 1;
                form.cbNoticiaAut.Enabled = false;
            }
            form.LoadData(true);

            switch (form.ShowDialog())
            {
                case DialogResult.OK:
                    var termo = form.ListTermos.ValidAuthorizedForm.Replace("'", "''");
                    switch (tna)
                    {
                        case TipoNoticiaAut.EntidadeProdutora:
                            var produtor = new Model.EntidadesInternas.Produtor();
                            produtor.Codigo = ((FormCreateEntidadeProdutora)form).txtCodigo.Text;
                            estado = TipoEstado.Novo;
                            rai = produtor;
                            break;
                        case TipoNoticiaAut.Onomastico:
                            rai = new Model.EntidadesInternas.Onomastico();
                            ((Model.EntidadesInternas.Onomastico)rai).Codigo = form.NIF;
                            estado = TipoEstado.Novo;
                            break;
                        case TipoNoticiaAut.Ideografico:
                            rai = new Model.EntidadesInternas.Ideografico();
                            estado = TipoEstado.Novo;
                            break;
                        case TipoNoticiaAut.ToponimicoGeografico:
                            rai = new Model.EntidadesInternas.Geografico();
                            estado = TipoEstado.Novo;
                            break;
                        case TipoNoticiaAut.TipologiaInformacional:
                            rai = new Model.EntidadesInternas.Tipologia();
                            var tipOriginal = this.correspDocumento.CorrespondenciasRAs.Where(cRa => cRa.GetEntidadeInterna(TipoOpcao.Original) != null && cRa.EntidadeInterna.GetType() == typeof(Model.EntidadesInternas.Tipologia)).SingleOrDefault();
                            estado = tipOriginal != null ? TipoEstado.Editar : TipoEstado.Novo;
                            break;
                    }
                    rai.Titulo = termo;
                    rai.Estado = TipoEstado.Novo;
                    ei = this.InternalEntitiesLst.AddInternalEntity(rai);
                    break;
                case DialogResult.Cancel:
                    cancel = true;
                    break;
            }
        }
예제 #10
0
 public void AddEntidadeInternaOriginal(EntidadeInterna ei)
 {
     this.mEscolhasEntidadesInternas[TipoOpcao.Original] = ei;
     this.EstadoRelacaoPorOpcao[TipoOpcao.Original]      = TipoEstado.SemAlteracoes;
 }
 void correspondenciaSuggestionPicker1_CreateEntidadeInterna(object sender, ref EntidadeInterna ei, TipoEntidadeExterna tee, out bool cancel, out TipoEstado estado)
 {
     this.CreateEntidadeInterna(this, ref ei, tee, out cancel, out estado);
 }
예제 #12
0
 public static void LoadDocumentDetails(EntidadeInterna ei)
 {
     var dg = ei as DocumentoGisa;
     var ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());
     try
     {
         DBAbstractDataLayer.DataAccessRules.IntGestDocRule.Current.LoadDocumentDetails(GisaDataSetHelper.GetInstance(), dg.Id, ho.Connection);
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex);
         throw;
     }
     finally
     {
         ho.Dispose();
     }
 }