private void PollListForm_Load(object sender, EventArgs e) { //EXECUTA CONSULTA RETORNANDO O DATASET ds1 = sqlInstruction.databaseconnection("SELECT COD_ENQ as 'Código',TIT_ENQ as 'Título',ITN1_ENQ as 'Item 1',ITN2_ENQ as 'Item 2',ITN3_ENQ as 'Item 3',ITN4_ENQ as 'Item 4', DT_ENQ as 'Data' FROM enquete"); //PREENCHE O DATAGRID DataGridViewCheckBoxColumn chkboxcolumn = new DataGridViewCheckBoxColumn(); chkboxcolumn.TrueValue = true; chkboxcolumn.FalseValue = false; dtGrListPoll.DataSource = ds1.Tables[0]; dtGrListPoll.Columns.Insert(0, chkboxcolumn); dtGrListPoll.Columns[0].Width = 30; dtGrListPoll.CellClick += new DataGridViewCellEventHandler(dtGrListPoll_CellClick); }
private void enterBtn_Click(object sender, EventArgs e) { string log = loginBox.Text; string pass = passBox.Text; //string md5Pass = objSql.criptografaMD5(log); ds = objSql.databaseconnection( "SELECT LOG_USU, SEN_USU, permissao_usuario.COD_PERMI " + "FROM usuario_sistema " + "INNER JOIN permissao_usuario ON permissao_usuario.COD_PERMI = usuario_sistema.COD_PERMI " + "WHERE LOG_USU = '" + log + "' AND SEN_USU = '" + pass + "'"); if (ds.Tables[0].Rows.Count > 0) { drow = ds.Tables[0].Rows[0]; if (log == drow["LOG_USU"].ToString() && pass == drow["SEN_USU"].ToString()) { enterBtn.Enabled = false; Form MainMenu = new MenuForm(); MainMenu.Show(); MainMenu.Activate(); timer2.Start(); } else { MessageBox.Show("Login ou Senha inválida.", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Login ou Senha inválida.", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//===========================AO CARREGAR O FORM==================================== private void ContaEdita_Load(object sender, EventArgs e) { //PREENCHE COMBOBOX ds1 = objSql.databaseconnection("SELECT * FROM permissao_usuario"); cboNivel.DataSource = ds1.Tables[0]; //EXIBIÇÃO - DESCRIÇÃO DO NÍVEL DE PERMISSÃO cboNivel.DisplayMember = "DESC_PERMI"; //CONTEÚDO - CÓDIGO DO NÍVEL DE PERMISSÃO cboNivel.ValueMember = "COD_PERMI"; //SE FOR MODO DE EDIÇÃO, PREENCHE OS CAMPOS DO USUÁRIO if (modoSave == "edicao") { ds1 = objConta.retornaUsuarioespecífico(codUsuSelSave); drow = ds1.Tables[0].Rows[0]; txtLoginUsu.Text = drow["Login"].ToString(); txtNomeUsu.Text = drow["Nome"].ToString(); txtSenha.Text = drow["Senha"].ToString(); txtConfirSenha.Text = drow["Senha"].ToString(); cboNivel.SelectedIndex = Convert.ToInt32(drow["Permissao"]) - 1; } }
public void PubDialogStart(String imagepath, String desc, Int32 numbers, PubForm fr1) { InitializeComponent(); xx = numbers; cmd = desc; //connection to database ds1 = class1.databaseconnection(desc); drow = ds1.Tables[0].Rows[xx - 1]; //placing stuff in their righteous place Titlebox.Text = drow.ItemArray.GetValue(1).ToString(); Enterprisebox.Text = drow.ItemArray.GetValue(2).ToString(); ImgPathBox.Text = imagepath; LinkBox.Text = drow.ItemArray.GetValue(5).ToString(); ValueBox.Text = drow.ItemArray.GetValue(4).ToString(); Datebox.Text = drow.ItemArray.GetValue(3).ToString(); this.Fr1 = fr1; }
public DataSet MsgEspecifica(string codNot) { SqlInstruction sqlInstruction = new SqlInstruction(); ds1 = sqlInstruction.databaseconnection("SELECT COD_CONT as 'Codigo', NOME_CONT as 'Titulo', MSG_CONT as 'Texto', DATA_CONT as 'Data', HORA_CONT as 'Hora' FROM dbo.contato WHERE COD_CONT = '" + codNot + "' UPDATE contato set LIDO_CONT = 1 where COD_CONT = '" + codNot + "'"); //RETORNA OS DADOS return(ds1); }
public DataSet listaTodosUsuariosWeb() { //BUSCA OS DADOS ds = objSql.databaseconnection( "SELECT COD_USU as 'Codigo', NOM_USU as 'Nome',permissao_usuario.COD_PERMI as 'Permissao' " + "FROM usuario " + "INNER JOIN ON = ORDER BY PTS_USU DESC"); //RETORNA A QUEM CHAMOU return(ds); }
//LISTA UMA NOTÍCIA ESPECÍFICA PARA EDIÇÃO public DataSet listaNoticiaEspecifica(string codNot) { SqlInstruction sqlInstruction = new SqlInstruction(); DataSet ds1 = new DataSet(); ds1 = sqlInstruction.databaseconnection("SELECT COD_NOT as 'Codigo', TIT_NOT as 'Titulo', TXT_NOT as 'Texto',DT_NOT as 'Data', PATH_IMG_INI_NOT as 'Imagem' FROM noticias WHERE COD_NOT = '" + codNot + "'"); //RETORNA OS DADOS return(ds1); }
//====================================NORMAIS==================================== //NOTÍCIAS NORMAIS - LISTAR public DataSet listaNoticiasNormais() { SqlInstruction sqlInstruction = new SqlInstruction(); DataSet ds1 = new DataSet(); ds1 = sqlInstruction.databaseconnection("SELECT COD_NOT as 'Codigo', TIT_NOT as 'Titulo', DT_NOT as 'Data' FROM noticias ORDER BY DT_NOT DESC"); //RETORNA OS DADOS return(ds1); }
//================================MENSAGENS================================ private void THISFORM_Load() { //ALTERNA VISUALIZAÇÃO DE PAINÉIS MsgListPanel.Visible = true; MessagePanel.Visible = false; //DESABILITA BOTÕES ocumosBotoes("messages"); //BUSCA OS DADOS ds1 = class1.databaseconnection("select COD_CONT as 'Código', NOME_CONT as 'Nome do Usuário', EMAIL_CONT as 'Email', (select DESC_ASSUNTO from assunto_contato INNER JOIN contato ON contato.COD_ASSUNTO_CONT = assunto_contato.COD_ASSUNTO) as 'Assunto' from dbo.contato ORDER BY contato.DATA_CONT"); //INSERE NO GRID dtGrListCont.Columns.Clear(); dtGrListCont.DataSource = ds1.Tables[0]; //ADICIONA GRID colunaDatagrid(); }
private void editarArtigo_Click(object sender, EventArgs e) { chkcounter = 0; //ALTERNA VISUALIZAÇÃO PAINEIS pnArtigo1.Visible = false; pnArtigo2.Visible = false; pnArtigo3.Visible = true; lblEstadoFormArtigo.Text = "Editar artigo"; //OCULTAO BOTÕES ocumosBotoes("artigo"); excluirArtigo.Enabled = true; //excluir excluirArtigo.Image = ((System.Drawing.Image)(Properties.Resources.delete)); publicarArtigo.Enabled = true; publicarArtigo.Visible = true; publicarArtigo.Image = ((System.Drawing.Image)(Properties.Resources.hbtn_pub)); //HABILITA O BOTÃO EXCLUIR E REMOVE O BOTÃO DE EDITAR excluirArtigo.Visible = true; editarArtigo.Visible = true; ds1 = null; //RETORNA O ARTIGO PARA EDITAR ds1 = sqlInstruction.databaseconnection("SELECT usuario.NOM_USU, usuario.SOBRE_USU, artigo.TIT_ART, artigo.TXT_ART, " + "artigo.DT_POST_ART, categoria.TIT_CTG,categoria.COD_CTG " + "FROM artigo INNER JOIN usuario ON usuario.COD_USU = artigo.COD_USU INNER JOIN categoria ON categoria.COD_CTG = artigo.COD_CTG " + "WHERE artigo.COD_ART = " + codArtSel + ";"); drow = ds1.Tables[0].Rows[0]; //TÍTULO txtTituloEditaArt.Text = drow["TIT_ART"].ToString(); //TEXTO richTextBox1.Text = drow["TXT_ART"].ToString(); //CATEGORIA lblCtgArt.Text = drow["TIT_CTG"].ToString(); //DATA E USUÁRIO lblListaTituloArtigo.Text = drow["DT_POST_ART"].ToString() + ", por " + drow["NOM_USU"].ToString() + drow["SOBRE_USU"].ToString() + "."; //CATEGORIA DO ARTIGO codCateSel = drow["COD_CTG"].ToString(); }
//LISTA PUBLICADOS public DataSet listaPublicados() { SqlInstruction sqlInstruction = new SqlInstruction(); DataSet ds1 = new DataSet(); //INSERE O CONTEÚDO AO CARREGAR ds1 = sqlInstruction.databaseconnection( "SELECT COD_ART as 'Código', DT_POST_ART as 'Data',PTS_ART as 'Pontos', categoria.TIT_CTG as 'Categoria' " + "FROM artigo INNER JOIN categoria ON categoria.COD_CTG = artigo.COD_CTG WHERE FLAG_ART_AP = 1 ORDER BY DT_POST_ART DESC,PTS_ART"); return(ds1); }
public void Databaseconnection(Int32 xx) { //Creation and Command DataSet ds1 = new DataSet(); string[] arrImg = new String[8]; if (xx == 0) { ds1 = class1.databaseconnection("select * from publicidade_top"); } else { ds1 = class1.databaseconnection("select * from publicidade_lateral"); } for (int x = 0; x <= 3; x++) { DataRow dRow = ds1.Tables[0].Rows[x]; arrImg[x] = dRow.ItemArray.GetValue(6).ToString(); } ImgBox1.ImageLocation = arrImg[0]; ImgBox2.ImageLocation = arrImg[1]; ImgBox3.ImageLocation = arrImg[2]; ImgBox4.ImageLocation = arrImg[3]; }
//====================================//NORMAIS==================================== //====================================DESTAQUES==================================== //NOTÍCIAS DESTACADAS - LISTAR public string[][] listaNoticiasDestacadas() { SqlInstruction sqlInstruction = new SqlInstruction(); DataSet ds1 = new DataSet(); DataRow drow; //MessageBox.Show(path + "EasyPHP5.2.10\\www\\TCC\\aqua\\pt-br\\img\\articles\\img_ini\\"); //Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "img"); string path1 = Path.GetPathRoot(AppDomain.CurrentDomain.BaseDirectory) + "TCC_ATUAL\\EasyPHP5.2.10\\www\\TCC\\aqua\\pt-br\\img\\articles\\img_ini\\"; ds1 = sqlInstruction.databaseconnection( "SELECT TOP 3 COD_DEST as 'Codigo', TIT_DEST as 'Titulo',PATH_IMG_INI_DEST as 'Imagem' FROM destaque WHERE FLAG_ANLS_DEST = 1 OR FLAG_IMG_DEST = 1 OR FLAG_VID_DEST = 1 ORDER BY COD_DEST"); //DEFINE ARRAY string[][] arrDados = new string[3][]; arrDados[0] = new string[3]; arrDados[1] = new string[3]; arrDados[2] = new string[3]; //MANDA TUDO PARA UM ARRAY for (int i = 0; i < 3; i++) { drow = ds1.Tables[0].Rows[i]; //IMAGENS arrDados[0][i] = path1 + drow["Imagem"].ToString(); //TÍTULOS arrDados[1][i] = drow["Titulo"].ToString(); //CÓDIGOS arrDados[2][i] = drow["Codigo"].ToString(); } //RETORNA OS DADOS return(arrDados); }
//NOTÍCIAS DESTACADAS - RETORNAR DADOS DE CADA DESTAQUE public string[] retornaDadosNoticiaDestacada(string codDest) { SqlInstruction sqlInstruction = new SqlInstruction(); DataSet ds1 = new DataSet(); DataRow drow; //BUSCA OS DADOS ds1 = sqlInstruction.databaseconnection( "SELECT TIT_DEST as 'Titulo'," + "TXT_DEST as 'Texto'," + "LINK_DEST as 'Link'," + "DT_DEST as 'Data'," + "HR_DEST as 'Hora'," + "PATH_IMG_INI_DEST as 'ImagemIni'," + "FLAG_IMG_DEST as 'FlagImg'," + "FLAG_VID_DEST as 'FlagVid'," + "FLAG_ANLS_DEST as 'FlagAna'," + "PATH_IMG1_DEST as 'Imagem1'," + "PATH_IMG2_DEST as 'Imagem2'," + "PATH_IMG3_DEST as 'Imagem3'," + "PATH_IMG4_DEST as 'Imagem4'," + "PATH_IMG5_DEST as 'Imagem5'," + "PATH_IMG6_DEST as 'Imagem6'," + "PATH_IMG7_DEST as 'Imagem7'," + "PATH_IMG8_DEST as 'Imagem8'," + "PATH_IMG9_DEST as 'Imagem9'," + "LINK1_VID_DEST as 'Video1'," + "LINK2_VID_DEST as 'Video2'," + "LINK3_VID_DEST as 'Video3'," + "LINK4_VID_DEST as 'Video4'," + "PLV_CHV_DEST1 as 'Palavra1'," + "PLV_CHV_DEST2 as 'Palavra2'," + "PLV_CHV_DEST3 as 'Palavra3'" + "FROM destaque WHERE COD_DEST = '" + codDest + "'"); //CONTA O NÚMERO DE LINHAS int nLinhas = ds1.Tables[0].Rows.Count; //DEFINE ARRAY string[] arrDados = new string[24]; string path1 = Path.GetPathRoot(AppDomain.CurrentDomain.BaseDirectory) + "TCC_ATUAL\\EasyPHP5.2.10\\www\\TCC\\aqua\\pt-br\\img\\articles\\img_ini\\"; string path2 = Path.GetPathRoot(AppDomain.CurrentDomain.BaseDirectory) + "TCC_ATUAL\\EasyPHP5.2.10\\www\\TCC\\aqua\\pt-br\\img\\articles\\img\\"; //PREENCHE O ARRAY drow = ds1.Tables[0].Rows[0]; //SINPSOSE EM GERAL arrDados[0] = drow["Titulo"].ToString(); arrDados[1] = drow["Texto"].ToString(); arrDados[2] = drow["Link"].ToString(); arrDados[3] = drow["Data"].ToString(); arrDados[4] = path1 + drow["ImagemIni"].ToString(); //FLAGS arrDados[5] = drow["FlagImg"].ToString(); arrDados[6] = drow["FlagVid"].ToString(); arrDados[7] = drow["FlagAna"].ToString(); //IMAGENS arrDados[8] = path2 + drow["Imagem1"].ToString(); arrDados[9] = path2 + drow["Imagem2"].ToString(); arrDados[10] = path2 + drow["Imagem3"].ToString(); arrDados[11] = path2 + drow["Imagem4"].ToString(); arrDados[12] = path2 + drow["Imagem5"].ToString(); arrDados[13] = path2 + drow["Imagem6"].ToString(); arrDados[14] = path2 + drow["Imagem7"].ToString(); arrDados[15] = path2 + drow["Imagem8"].ToString(); arrDados[16] = path2 + drow["Imagem9"].ToString(); //VÍDEOS arrDados[17] = drow["Video1"].ToString(); arrDados[18] = drow["Video2"].ToString(); arrDados[19] = drow["Video3"].ToString(); arrDados[20] = drow["Video4"].ToString(); //PALAVRAS-CHAVE arrDados[21] = drow["Palavra1"].ToString(); arrDados[22] = drow["Palavra2"].ToString(); arrDados[23] = drow["Palavra3"].ToString(); return(arrDados); }