protected void btnEntrar_Click(object sender, EventArgs e) { Usu_Usuario usuario = new Usu_Usuario(); Usu_UsuarioDB usuarioDB = new Usu_UsuarioDB(); usuario.Usu_login = Convert.ToInt32(txtLogin.Text); usuario.Usu_senha = Sam.Funcoes.Funcoes.HashCriptografia(txtSenha.Text, "SHA512"); usuario = usuarioDB.SelecionarPorLogin(usuario); if (usuario != null) { if (usuario.Usu_status == 1) { Session.Add("usuario", usuario); // HISTÓRICO // ------------------------------------ Hst_Historico historico = new Hst_Historico(); Hst_HistoricoDB historicoDB = new Hst_HistoricoDB(); historico.Hst_data = DateTime.Now; historico.Hst_atividade = "Logou no Sistema"; Hst_HistoricoDB.Insert(historico); //-------------------------------------------------- if (usuario.Usu_data_acesso == null) { Response.Redirect("RedefinirSenha.aspx"); } else { Response.Redirect("EscolherPerfil.aspx"); } } else { Response.Write(@"<script language='javascript'>alert('Usuário Desativado!');</script>"); } } else { Response.Write(@"<script language='javascript'>alert('Usuário Não Cadastrado ou Senha Incorreta!');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { //CarregarGrid(); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; var iso = Encoding.GetEncoding("iso-8859-1"); HttpContext.Current.Response.Charset = iso.WebName; HttpContext.Current.Response.AddHeader("content-disposition", "filename=" + DateTime.Now + ".xls"); HttpContext.Current.Response.ContentEncoding = iso; DataSet DS = Hst_HistoricoDB.SelectAll(); //Sam.Funcoes.Funcoes.CarregarGridComDS(gridHistorico, DS); Literal lbl = new Literal(); lbl.Text = "<table>"; foreach (DataRow dr in DS.Tables[0].Rows) { lbl.Text += "<tr><td>" + dr[0] + "</td><td>" + dr[1] + "</td><td>" + dr[2] + "</td><td>" + dr[3] + "</td><td>" + dr[4] + "</td></tr>"; } lbl.Text += "</table>"; HttpContext.Current.Response.Write(lbl.Text); HttpContext.Current.Response.End(); }
public void CarregarGrid() { DataSet DS = Hst_HistoricoDB.SelectAll(); Sam.Funcoes.Funcoes.CarregarGridComDS(gridHistorico, DS); }