示例#1
0
        public static IList<TPalavrasChave> RetornaListaPalavras(string palavras)
        {
            IList<TPalavrasChave> iPalavraChave = new List<TPalavrasChave>();
            if (!string.IsNullOrEmpty(palavras))
            {
                string[] arr = palavras.Split(',');
                for (int i = 0; i < arr.Length; i++)
                {
                    TPalavrasChave dtoPalavraChave = new TPalavrasChave();
                    dtoPalavraChave.Palavrachave = arr[i].Trim();
                    iPalavraChave.Add(dtoPalavraChave);
                }
            }

            return iPalavraChave;
        }
示例#2
0
        public IList<TPalavrasChave> Listar(Int64 imgId)
        {
            string _sql;
            SqlDataReader dr;
            IList<TPalavrasChave> lst;
            TPalavrasChave dto;

            try
            {
                _sql = "SELECT A.PC_ID, A.PC_PALAVRA_CHAVE, A.PC_FONETICA, A.PC_DT_CRIACAO " +
                        "FROM BI_PALAVRA_CHAVE A, BI_IMG_X_PC B WHERE A.PC_ID = B.PC_ID AND B.IMG_ID = " + imgId;

                dr = SqlHelper.ExecuteReader(conn, CommandType.Text, _sql);

                lst = new List<TPalavrasChave>();
                dto = new TPalavrasChave();

                while (dr.Read())
                {
                    dto = new TPalavrasChave();

                    dto.Id = dr.GetInt64(0);
                    dto.Palavrachave = dr.GetString(1);
                    dto.Fonetica = dr.GetString(2);
                    dto.DataCriacao = dr.GetDateTime(3);

                    lst.Add(dto);
                }

                return lst;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidaForm())
                {
                    BImagens objBO = BImagens.getInstance();
                    TImagens dto = new TImagens();

                    dto.Id = _id;
                    dto.Codigo = txtCodigo.Text;
                    dto.Titulo = txtTitulo.Text;
                    dto.Detalhes = txtDetalhes.Text;
                    dto.AUI = ddlAUI.SelectedValue;
                    dto.Orientacao = ddlOrientacoes.SelectedValue;

                    //DTOS
                    TDisponibilidades dtoDisp = new TDisponibilidades();
                    dtoDisp.Id = Convert.ToInt32(ddlFormatos.SelectedValue);
                    dto.Disponibilidade = dtoDisp;

                    TFornecedores dtoForn = new TFornecedores();
                    dtoForn.Id = Convert.ToInt32(ddlFornecedores.SelectedValue);
                    dto.Fornecedor = dtoForn;

                    IList<TPalavrasChave> lst = new List<TPalavrasChave>();;

                    for (int i = 0; i < ltbKeys.Items.Count; i++)
                    {
                        TPalavrasChave dtoPc = new TPalavrasChave();
                        dtoPc.Palavrachave = ltbKeys.Items[i].Text.Trim();
                        lst.Add(dtoPc);
                    }

                    dto.PalavrasChave = lst;

                    TPastas dtoPasta = new TPastas();
                    dtoPasta.Id = Convert.ToInt32(ddlPastas.SelectedValue);
                    dto.Pasta = dtoPasta;

                    TSubCategorias dtoSubTema = new TSubCategorias();
                    dtoSubTema.Id = Convert.ToInt32(ddlSubTemas.SelectedValue);
                    dto.Subtema = dtoSubTema;

                    TTiposLicenca dtoTpLicenca = new TTiposLicenca();
                    dtoTpLicenca.Id = Convert.ToInt32(ddlTpLicencas.SelectedValue);
                    dto.TipoLicenca = dtoTpLicenca;

                    objBO.Alterar(dto);

                    objBO = null;

                    Response.Redirect("ImagesList.aspx");
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = "Problema ao salvar dados da imagem: " + ex.Message;
            }
        }