Beispiel #1
0
        public void AddConhecimento(TalentoConhecimento conhecimento)
        {
            if (Conhecimentos == null)
            {
                Conhecimentos = new List <TalentoConhecimento>();
            }

            Conhecimentos.Add(conhecimento);
        }
        public void Preenche(string con)
        {
            id_conn = con;
            var           ls   = conhe.getConhecimentoDetails(id_conn);
            Conhecimentos conn = ls;

            propertyGridInfo.Preenche_UserControl(conn);

            textEditor.Text = ls.Codigo;

            this.VerifyButton(numButtons);
        }
Beispiel #3
0
        //public void AddBanco(TalentoBanco banco) => Banco = banco;

        public void AddRangeConhecimento(IEnumerable <TalentoConhecimento> conhecimentos)
        {
            TalentoConhecimento conhecimento;

            foreach (var item in conhecimentos)
            {
                conhecimento = Conhecimentos.FirstOrDefault(c => c.ConhecimentoID == item.ConhecimentoID && c.TalentoID == item.TalentoID);

                if (conhecimento != null)
                {
                    conhecimento.SetNivel(item.Nivel);
                }
                else
                {
                    AddConhecimento(item);
                }
            }
        }
        public bool Delete_Conhecimento(string Id)
        {
            bool done = false;

            var anexo = new Anexo();

            anexo.DeleteAnexosbyConhecimento(Id);

            try
            {
                var           bd           = new BDKnowLedge();
                Conhecimentos conhecimento = bd.Conhecimentos.Single(u => u.StampConhecimento == Id);
                bd.Conhecimentos.Remove(conhecimento);
                bd.SaveChanges();
                done = true;
            }
            catch
            {
                done = false;
            }

            return(done);
        }
        public void Preenche_UserControl(Conhecimentos con)
        {
            Projetos  fil     = null;
            Tipos     type    = null;
            Subtipos  subtype = null;
            Entidades empre   = null;

            try
            {
                _files.Clear();
                id_con          = con.StampConhecimento;
                ballontext.Text = "Data da ultima actualização: " + con.Usrdata.ToString();

                textbox_Metadados.Text = con.Metadados.ToString();

                if (con.Mensagem != null && con.Mensagem != "")
                {
                    MensagemConhecimento.Text = con.Mensagem.ToString();
                }

                if (con.Ecra != null && con.Ecra != "")
                {
                    textbox_Ecra.Text = con.Ecra.ToString();
                }

                if (con.Tabela != null && con.Tabela != "")
                {
                    textbox_Tabela.Text = con.Tabela.ToString();
                }

                if (con.Teclas != null && con.Teclas != "")
                {
                    textbox_Teclas.Text = con.Teclas.ToString();
                }

                if (con.Descricao != null && con.Descricao != "")
                {
                    DescricaoConhecimento.Text = con.Descricao.ToString();
                }

                if (con.StampProjeto != null)
                {
                    fil   = projeto.getProjetosDetails(con.StampProjeto);
                    empre = entidade.getentidadeDetails(fil.StampEntidade);
                    AutoComplete1.Text           = empre.Nome;
                    combo_projetos.SelectedValue = fil.Nome;
                }

                if (con.StampTipo != null)
                {
                    type = tipo.getTipoDetails(con.StampTipo);
                    combo_tipo.SelectedValue = type.Nome;
                }

                if (con.StampSubtipo != null)
                {
                    subtype = subtipo.getSubtipoDetails(con.StampSubtipo);
                    combo_subtipo.SelectedValue = subtype.Nome;
                }

                switch (con.NivelAprovacao)
                {
                case 0:
                    Star1.State = StarState.Off;
                    Star2.State = StarState.Off;
                    Star3.State = StarState.Off;
                    Star4.State = StarState.Off;
                    Star5.State = StarState.Off;
                    break;

                case 1:
                    Star1.State = StarState.On;
                    Star2.State = StarState.Off;
                    Star3.State = StarState.Off;
                    Star4.State = StarState.Off;
                    Star5.State = StarState.Off;
                    break;

                case 2:
                    Star1.State = StarState.On;
                    Star2.State = StarState.On;
                    Star3.State = StarState.Off;
                    Star4.State = StarState.Off;
                    Star5.State = StarState.Off;
                    break;

                case 3:
                    Star1.State = StarState.On;
                    Star2.State = StarState.On;
                    Star3.State = StarState.On;
                    Star4.State = StarState.Off;
                    Star5.State = StarState.Off;
                    break;

                case 4:
                    Star1.State = StarState.On;
                    Star2.State = StarState.On;
                    Star3.State = StarState.On;
                    Star4.State = StarState.On;
                    Star5.State = StarState.Off;
                    break;

                case 5:
                    Star1.State = StarState.On;
                    Star2.State = StarState.On;
                    Star3.State = StarState.On;
                    Star4.State = StarState.On;
                    Star5.State = StarState.On;
                    break;

                default:
                    break;
                }

                Preenche_Combo_Files();
                VerificaButtons();
            }
            catch
            {
            }
        }
        public bool InsertConhecimento(List <string> ls)
        {
            bool     done         = true;
            var      bd           = new BDKnowLedge();
            var      conhecimento = new Conhecimentos();
            var      dataControl  = new DataControl();
            DateTime dt           = dataControl.GeraDataHora();
            var      encoding     = new ASCIIEncoding();

            Byte[] bytes = null;
            int    nr    = 0;

            int i = 0;

            try
            {
                foreach (string res in ls)
                {
                    switch (i)
                    {
                    case 0:
                        if (res.Trim() == "")
                        {
                            _returnStamp = dataControl.GenerateStamp();
                            conhecimento.StampConhecimento = _returnStamp;
                        }
                        else
                        {
                            _returnStamp = res;
                            conhecimento.StampConhecimento = _returnStamp;
                        }
                        break;

                    case 1:
                        conhecimento.StampProjeto = res;
                        break;

                    case 2:
                        conhecimento.StampSubtipo = res;
                        break;

                    case 3:
                        conhecimento.StampTipo = res;
                        break;

                    case 4:
                        conhecimento.Descricao = res;
                        break;

                    case 5:
                        conhecimento.Codigo = res;
                        break;

                    case 6:
                        conhecimento.Metadados = res;
                        break;

                    case 7:
                        conhecimento.Ecra = res;
                        break;

                    case 8:
                        conhecimento.Mensagem = res;
                        break;

                    case 9:
                        conhecimento.Teclas = res;
                        break;

                    case 10:
                        conhecimento.Tabela = res;
                        break;

                    case 11:
                        try
                        {
                            nr = Convert.ToInt32(res);
                            if (nr > 0)
                            {
                                conhecimento.NivelAprovacao = nr;
                            }
                            else
                            {
                                conhecimento.NivelAprovacao = 0;
                            }
                        }
                        catch
                        {
                            conhecimento.NivelAprovacao = 0;
                        }
                        break;

                    case 12:
                        conhecimento.Ousrinis = Global.idUser;
                        break;

                    case 13:
                        try
                        {
                            if (res.Trim() == "")
                            {
                                conhecimento.Ousrdata = dt;
                            }
                            else
                            {
                                conhecimento.Ousrdata = Convert.ToDateTime(res);
                            }
                        }
                        catch
                        {
                            conhecimento.Ousrdata = dt;
                        }
                        break;

                    case 14:
                        if (res.Trim() == "")
                        {
                            conhecimento.Ousrhora = dataControl.GeraHora(dt);
                        }
                        else
                        {
                            conhecimento.Ousrhora = res;
                        }
                        break;

                    case 15:
                        conhecimento.Usrinis = Global.idUser;
                        break;

                    case 16:
                        try
                        {
                            if (res.Trim() == "")
                            {
                                conhecimento.Usrdata = dt;
                            }
                            else
                            {
                                conhecimento.Usrdata = Convert.ToDateTime(res);
                            }
                        }
                        catch
                        {
                            conhecimento.Usrdata = dt;
                        }
                        break;

                    case 17:
                        if (res.Trim() == "")
                        {
                            conhecimento.Usrhora = dataControl.GeraHora(dt);
                        }
                        else
                        {
                            conhecimento.Usrhora = res;
                        }
                        break;
                    }
                    i++;
                }

                bd.Conhecimentos.Add(conhecimento);


                bd.SaveChanges();
            }
            catch
            {
                done = false;
            }

            return(done);
        }
        public bool UpdateConhecimento(string Id, List <string> ls)
        {
            var           bd           = new BDKnowLedge();
            bool          done         = true;
            var           dataControl  = new DataControl();
            DateTime      dt           = dataControl.GeraDataHora();
            var           encoding     = new ASCIIEncoding();
            Conhecimentos conhecimento = bd.Conhecimentos.Single(u => u.StampConhecimento == Id);

            Byte[] bytes;
            int    i = 0, nr = 0;


            try
            {
                foreach (string res in ls)
                {
                    switch (i)
                    {
                    case 0:
                        conhecimento.StampConhecimento = conhecimento.StampConhecimento;
                        break;

                    case 1:
                        conhecimento.StampProjeto = res;
                        break;

                    case 2:
                        conhecimento.StampSubtipo = res;
                        break;

                    case 3:
                        conhecimento.StampTipo = res;
                        break;

                    case 4:
                        conhecimento.Descricao = res;
                        break;

                    case 5:
                        conhecimento.Codigo = res;
                        break;

                    case 6:
                        conhecimento.Metadados = res;
                        break;

                    case 7:
                        conhecimento.Ecra = res;
                        break;

                    case 8:
                        conhecimento.Mensagem = res;
                        break;

                    case 9:
                        conhecimento.Teclas = res;
                        break;

                    case 10:
                        conhecimento.Tabela = res;
                        break;

                    case 11:
                        try
                        {
                            nr = Convert.ToInt32(res);
                            if (nr > 0)
                            {
                                conhecimento.NivelAprovacao = nr;
                            }
                            else
                            {
                                conhecimento.NivelAprovacao = conhecimento.NivelAprovacao;
                            }
                        }
                        catch
                        {
                            conhecimento.NivelAprovacao = conhecimento.NivelAprovacao;
                        }
                        break;

                    case 12:
                        conhecimento.Ousrinis = conhecimento.Ousrinis;
                        break;

                    case 13:
                        try
                        {
                            conhecimento.Ousrdata = conhecimento.Ousrdata;
                        }
                        catch
                        {
                        }
                        break;

                    case 14:
                        conhecimento.Ousrhora = conhecimento.Ousrhora;
                        break;

                    case 15:
                        conhecimento.Usrinis = Global.idUser;
                        break;

                    case 16:
                        try
                        {
                            conhecimento.Usrdata = dt;
                        }
                        catch
                        {
                        }
                        break;

                    case 17:
                        conhecimento.Usrhora = dataControl.GeraHora(dt);
                        break;
                    }
                    i++;
                }

                bd.SaveChanges();
            }
            catch
            {
                done = false;
            }

            return(done);
        }