private bool CreateDocumentoInterno(ref EntidadeInterna ei, long tnr) { bool cancel = false; FormAddNivel form = new FormAddNivel(); form.IDTipoNivelRelacionado = tnr; 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 = TipoEntidadeInterna.DocumentoComposto; 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); }
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.D)) { 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; } }
private void cbOptions_SelectedIndexChanged(object sender, EventArgs e) { bool cancel = false; TipoEstado estado = TipoEstado.Novo; EntidadeInterna ei = this.Correspondencia.EntidadeInterna; if (object.ReferenceEquals(this.cbOptions.SelectedItem, cbItemNovo)) { this.CreateEntidadeInterna(this, ref ei, this.Correspondencia.EntidadeExterna.Tipo, out cancel, out estado); if (!cancel) { this.Correspondencia.TipoOpcao = TipoOpcao.Trocada; this.Correspondencia.EntidadeInterna = ei; this.Correspondencia.EstadoRelacaoPorOpcao[this.Correspondencia.TipoOpcao] = this.Correspondencia.EstadoRelacaoPorOpcao.ContainsKey(TipoOpcao.Original) ? TipoEstado.Editar: estado; this.SuggestionEdited(this); } UpdateList(); SelectOption(this.Correspondencia.TipoOpcao); return; } else if (object.ReferenceEquals(this.cbOptions.SelectedItem, cbItemProcurar)) { this.BrowseEntidadeInterna(this, ref ei, this.Correspondencia.EntidadeExterna.Tipo, out cancel, out estado); if (!cancel) { this.Correspondencia.TipoOpcao = TipoOpcao.Trocada; this.Correspondencia.EntidadeInterna = ei; this.Correspondencia.EstadoRelacaoPorOpcao[this.Correspondencia.TipoOpcao] = estado; this.SuggestionEdited(this); } UpdateList(); SelectOption(this.Correspondencia.TipoOpcao); return; } else if (object.ReferenceEquals(this.cbOptions.SelectedItem, cbItemIgnorar)) { this.mCorrespondencia.TipoOpcao = TipoOpcao.Ignorar; this.SuggestionEdited(this); } else { foreach (TipoOpcao op in Enum.GetValues(typeof(TipoOpcao))) { if (object.ReferenceEquals(this.cbOptions.SelectedItem, this.Correspondencia.GetEntidadeInterna(op))) { this.mCorrespondencia.TipoOpcao = op; break; } } } if (this.SelectedOptionChanged != null) { this.SelectedOptionChanged(); } this.toolTip1.SetToolTip(this.cbOptions, this.cbOptions.Text); }
void suggestionPickerDocumento_CreateEntidadeInterna(object sender, ref EntidadeInterna ei, TipoEntidadeExterna tee, out bool cancel, out TipoEstado estado) { estado = TipoEstado.Novo; cancel = CreateDocumentoInterno(ref ei, TipoNivelRelacionado.D); if (!cancel) { txtID.Text = "Não atribuido"; } }
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); }
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); }
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.D }); if (!cancel) { txtID.Text = ei.Id.ToString(); Database.Database.LoadDocumentDetails(ei); } }
private void SelectOption(TipoOpcao tipoCorrespondencia) { EntidadeInterna ei = null; if (this.mCorrespondencia != null) { this.mCorrespondencia.TipoOpcao = tipoCorrespondencia; ei = this.mCorrespondencia.EntidadeInterna; } if (this.cbOptions.SelectedItem != ei) { this.cbOptions.SelectedItem = ei; } }
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; } } }
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); }
private static Correspondencia CreateCorrespondenciaRAs(Model.EntidadeExterna ee, EntidadeInterna ei, TipoSugestao tipoSugestao) { return(new CorrespondenciaRAs((RegistoAutoridadeExterno)ee, (RegistoAutoridadeInterno)ei, tipoSugestao));; }
private static Correspondencia CreateCorrespondenciaDocsCompostos(Model.EntidadeExterna ee, EntidadeInterna ei, TipoSugestao tipoSugestao) { return(new CorrespondenciaDocs((DocumentoComposto)ee, (DocumentoGisa)ei, tipoSugestao)); }
private void cbOptions_SelectedIndexChanged(object sender, EventArgs e) { bool cancel = false; TipoEstado estado = TipoEstado.Novo; var prop = this.Propriedade; if (object.ReferenceEquals(this.cbOptions.SelectedItem, cbItemEditar)) { this.CreateSuggestion(this, ref prop, out cancel, out estado); if (!cancel) { this.SuggestionEdited(this); } UpdateList(); SelectOption(this.Propriedade.TipoOpcao); return; } else if (object.ReferenceEquals(this.cbOptions.SelectedItem, cbItemNovo)) { EntidadeInterna ei = this.Propriedade.Valor as EntidadeInterna; this.CreateEntidadeInterna(this, ref prop, out cancel, out estado); if (!cancel) { this.SuggestionEdited(this); } UpdateList(); SelectOption(this.Propriedade.TipoOpcao); return; } else if (object.ReferenceEquals(this.cbOptions.SelectedItem, cbItemProcurar)) { EntidadeInterna ei = this.Propriedade.Valor as EntidadeInterna; this.BrowseEntidadeInterna(this, ref prop, out cancel, out estado); if (!cancel) { this.SuggestionEdited(this); } UpdateList(); SelectOption(this.Propriedade.TipoOpcao); return; } else if (object.ReferenceEquals(this.cbOptions.SelectedItem, cbItemIgnorar)) { this.mPropriedade.TipoOpcao = TipoOpcao.Ignorar; this.SuggestionEdited(this); } else { foreach (TipoOpcao op in Enum.GetValues(typeof(TipoOpcao))) { if (this.Propriedade.Escolhas.ContainsKey(op) && this.Propriedade.Escolhas[op].Equals(this.cbOptions.SelectedItem)) { this.mPropriedade.TipoOpcao = op; break; } } } if (this.SelectedOptionChanged != null) { this.SelectedOptionChanged(this); } this.toolTip1.SetToolTip(this.cbOptions, this.cbOptions.Text); }
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(); break; case TipoNoticiaAut.Ideografico: rai = new Model.EntidadesInternas.Ideografico(); break; case TipoNoticiaAut.ToponimicoGeografico: rai = new Model.EntidadesInternas.Geografico(); 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; } }
void suggestionPickerRA_CreateEntidadeInterna(object sender, ref EntidadeInterna ei, TipoEntidadeExterna tee, out bool cancel, out TipoEstado estado) { cancel = false; estado = TipoEstado.Novo; 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; rai = produtor; break; case TipoNoticiaAut.Onomastico: rai = new Model.EntidadesInternas.Onomastico(); ((Model.EntidadesInternas.Onomastico)rai).Codigo = form.NIF; break; case TipoNoticiaAut.Ideografico: rai = new Model.EntidadesInternas.Ideografico(); break; case TipoNoticiaAut.ToponimicoGeografico: rai = new Model.EntidadesInternas.Geografico(); break; case TipoNoticiaAut.TipologiaInformacional: rai = new Model.EntidadesInternas.Tipologia(); break; } rai.Titulo = termo; rai.Estado = TipoEstado.Novo; ei = this.InternalEntitiesLst.AddInternalEntity(rai); break; case DialogResult.Cancel: cancel = true; break; } }