Beispiel #1
0
        private void btnAddAlfabeto_Click(object sender, System.EventArgs e)
        {
            if (CurrentSFRDCondicaoDeAcesso.RowState == DataRowState.Detached)
            {
                MessageBox.Show("O Nivel selecionado como contexto foi " + System.Environment.NewLine + "apagada por outro utilizador e por esse motivo não pode ser editada.", "Seleção de Nivel", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            FormPickISOs frmPick = new FormPickISOs(true);

            frmPick.Title = "Alfabetos";
            frmPick.reloadList();

            switch (frmPick.ShowDialog())
            {
            case DialogResult.OK:
                foreach (ListViewItem li in frmPick.SelectedItems)
                {
                    GISADataset.Iso15924Row     alphaRow = null;
                    GISADataset.SFRDAlfabetoRow sARow    = null;
                    alphaRow = (GISADataset.Iso15924Row)li.Tag;
                    string query = string.Format("IDIso15924={0} AND IDFRDBase={1}", alphaRow.ID, CurrentSFRDCondicaoDeAcesso.IDFRDBase);

                    if ((GisaDataSetHelper.GetInstance().SFRDAlfabeto.Select(query)).Length == 0)
                    {
                        sARow            = GisaDataSetHelper.GetInstance().SFRDAlfabeto.NewSFRDAlfabetoRow();
                        sARow.IDIso15924 = alphaRow.ID;
                        sARow.SFRDCondicaoDeAcessoRow = CurrentSFRDCondicaoDeAcesso;
                        sARow.isDeleted = 0;

                        GisaDataSetHelper.GetInstance().SFRDAlfabeto.AddSFRDAlfabetoRow(sARow);

                        if (sARow.RowState == DataRowState.Detached)
                        {
                            MessageBox.Show("Não foi possível estabelecer a relação uma vez que a Linguagem " + System.Environment.NewLine + "que pretende associar foi apagada por outro utilizador.", "Erro ao estabelecer relação", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        }
                    }
                    else
                    {
                        MessageBox.Show("A relação que pretende adicionar já existe.", "Erro ao estabelecer relação", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                }
                LoadAlfabetoAndLingua();
                break;

            case DialogResult.Cancel:
                break;
            }
        }
Beispiel #2
0
        public void reloadList()
        {
            List <ListViewItem> items = new List <ListViewItem>();
            ListViewItem        item  = null;

            lstVwAlf.BeginUpdate();
            lstVwAlf.Items.Clear();

            if (isAlphabet)
            {
                // criar clone da tabela para permitir filtrar em case insensitive
                GISADataset.Iso15924DataTable dt = new GISADataset.Iso15924DataTable();
                dt.IDColumn.AutoIncrementSeed = 1;
                dt.CaseSensitive = false;
                foreach (GISADataset.Iso15924Row row in GisaDataSetHelper.GetInstance().Iso15924.Select())
                {
                    GISADataset.Iso15924Row rowIso15924Row = ((GISADataset.Iso15924Row)(dt.NewRow()));
                    object[] columnValuesArray             = new object[] {
                        row.ID,
                        row.ScriptNameEnglish,
                        row.CodeAlpha2,
                        row.CodeAlpha3,
                        row.CodeNumeric,
                        row.Versao,
                        row.isDeleted
                    };
                    rowIso15924Row.ItemArray = columnValuesArray;
                    dt.AddIso15924Row(rowIso15924Row);
                }
                dt.AcceptChanges();

                foreach (GISADataset.Iso15924Row row in dt.Select(TextFilter, "ScriptNameEnglish"))
                {
                    item = new ListViewItem();
                    items.Add(item);
                    item.Text = row.ScriptNameEnglish;
                    item.SubItems.Add(row.CodeAlpha2);
                    item.SubItems.Add(row.CodeAlpha3);
                    item.SubItems.Add(row.CodeNumeric.ToString());
                    item.Tag = row;
                }
            }
            else
            {
                // criar clone da tabela para permitir filtrar em case insensitive
                GISADataset.Iso639DataTable dt = new GISADataset.Iso639DataTable();
                dt.IDColumn.AutoIncrementSeed = 1;
                dt.CaseSensitive = false;
                foreach (GISADataset.Iso639Row row in GisaDataSetHelper.GetInstance().Iso639.Select("", "ID"))
                {
                    GISADataset.Iso639Row rowIso639Row = ((GISADataset.Iso639Row)(dt.NewRow()));
                    object[] columnValuesArray         = new object[] {
                        row.ID,
                        row.LanguageNameEnglish,
                        row.BibliographicCodeAlpha3,
                        row.TerminologyCodeAlpha3,
                        row.Versao,
                        row.isDeleted
                    };
                    rowIso639Row.ItemArray = columnValuesArray;
                    dt.AddIso639Row(rowIso639Row);
                }
                dt.AcceptChanges();

                foreach (GISADataset.Iso639Row row in dt.Select(TextFilter, "LanguageNameEnglish"))
                {
                    item = new ListViewItem();
                    items.Add(item);
                    item.Text = row.LanguageNameEnglish;
                    item.SubItems.Add(row.BibliographicCodeAlpha3);
                    item.SubItems.Add(row.TerminologyCodeAlpha3);
                    item.Tag = row;
                }
            }

            if (items.Count > 0)
            {
                lstVwAlf.Items.AddRange(items.ToArray());
            }

            lstVwAlf.EndUpdate();
        }
Beispiel #3
0
        public override void ModelToView()
        {
            IsPopulated = false;

            ControloRevisoes1.ControloAutores1.LoadAndPopulateAuthors();
            if (SessionHelper.GetGisaPrincipal().TrusteeUserAuthor != null)
            {
                ControloRevisoes1.ControloAutores1.SelectedAutor = SessionHelper.GetGisaPrincipal().TrusteeUserAuthor.TrusteeRow;
            }

            txtIdentificadorRegisto.Text = CurrentControloAut.ID.ToString();

            if (!(CurrentControloAut.IsRegrasConvencoesNull()))
            {
                txtRegrasConvencoes.Text = CurrentControloAut.RegrasConvencoes;
            }
            else
            {
                txtRegrasConvencoes.Text = "";
            }

            if (!(CurrentControloAut.IsObservacoesNull()))
            {
                txtObservacoes.Text = CurrentControloAut.Observacoes;
            }
            else
            {
                txtObservacoes.Text = "";
            }

            lstVwIdentidadeInstituicoes.Items.Clear();
            foreach (GISADataset.ControloAutRelRow carRow in GisaDataSetHelper.GetInstance().ControloAutRel.Select(QueryFilter))
            {
                AddIdentidadeInstituicao(carRow);
            }

            UpdateLstVwIdentidadeInstituicoesButtonsState();

            // populate datas criacao history
            lstVwDataCriacaoRevisao.Items.Clear();
            ListViewItem item = null;

            foreach (GISADataset.ControloAutDataDeDescricaoRow cadddRow in GisaDataSetHelper.GetInstance().ControloAutDataDeDescricao.Select(QueryFilter, "DataEdicao DESC"))
            {
                item = lstVwDataCriacaoRevisao.Items.Add("");
                item.SubItems.AddRange(new string[] { "", "", "" });
                item.SubItems[colDataRegisto.Index].Text   = cadddRow.DataEdicao.ToString();
                item.SubItems[colDataDescricao.Index].Text = string.Format("{0:yyyy}-{0:MM}-{0:dd}", cadddRow.DataAutoria);

                if (SessionHelper.AppConfiguration.GetCurrentAppconfiguration().TipoServer.ID == Convert.ToInt64(TipoServer.ClienteServidor))
                {
                    item.SubItems[colOperator.Index].Text = cadddRow.TrusteeUserRowByTrusteeUserControloAutDataDeDescricao.TrusteeRow.Name;
                }

                if (!cadddRow.IsIDTrusteeAuthorityNull())
                {
                    item.SubItems[colAuthority.Index].Text = cadddRow.TrusteeUserRowByTrusteeUserControloAutDataDeDescricaoAuthority.TrusteeRow.Name;
                }

                item.Tag = cadddRow;
            }

            lstVwDataCriacaoRevisao.SelectedItems.Clear();
            // the following should ensure the list was scrolled all the
            // way to the bottom. it doesn't always not working though.
            if (lstVwDataCriacaoRevisao.Items.Count > 0)
            {
                lstVwDataCriacaoRevisao.EnsureVisible(0);
            }

            // populate linguas
            ArrayList Iso639Data = new ArrayList();

            GISADataset.Iso639Row i639Row = (GISADataset.Iso639Row)(GisaDataSetHelper.GetInstance().Iso639.NewRow());
            i639Row.ID = -1;
            i639Row.LanguageNameEnglish = "";
            Iso639Data.Add(i639Row);
            Iso639Data.AddRange(GisaDataSetHelper.GetInstance().Iso639.Select());
            cbLingua.DataSource    = Iso639Data;
            cbLingua.DisplayMember = "LanguageNameEnglish";
            cbLingua.ValueMember   = "ID";
            try
            {
                cbLingua.SelectedValue = CurrentControloAut.IDIso639p2;
            }
            catch (StrongTypingException)
            {
                cbLingua.SelectedValue = -1;
            }

            // populate alfabetos
            ArrayList Iso15924Data = new ArrayList();

            GISADataset.Iso15924Row i15924Row = (GISADataset.Iso15924Row)(GisaDataSetHelper.GetInstance().Iso15924.NewRow());
            i15924Row.ID = -1;
            i15924Row.ScriptNameEnglish = "";
            Iso15924Data.Add(i15924Row);
            Iso15924Data.AddRange(GisaDataSetHelper.GetInstance().Iso15924.Select());
            cbAlfabeto.DataSource    = Iso15924Data;
            cbAlfabeto.DisplayMember = "ScriptNameEnglish";
            cbAlfabeto.ValueMember   = "ID";
            try
            {
                cbAlfabeto.SelectedValue = CurrentControloAut.IDIso15924;
            }
            catch (StrongTypingException)
            {
                cbAlfabeto.SelectedValue = -1;
            }

            // populate checkboxes
            chkDefinitivo.Checked = CurrentControloAut.Autorizado;
            chkCompleta.Checked   = CurrentControloAut.Completo;
            IsPopulated           = true;
        }