public DataTable transformaTextoEmDataTable(string[] arquivos) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("nome", typeof(string))); dt.Columns.Add(new DataColumn("tamanho", typeof(string))); dt.Columns.Add(new DataColumn("extensao", typeof(string))); dt.Columns.Add(new DataColumn("url", typeof(string))); dt.Columns.Add(new DataColumn("caminho", typeof(string))); for (int i = 0; i < arquivos.Length; i++) { DataRow dr = dt.NewRow(); string arquivo = arquivos[i]; FileInfo fil = new FileInfo(arquivo); dr["nome"] = fil.Name; dr["extensao"] = fil.Extension; dr["url"] = "http://" + Request.ServerVariables["SERVER_NAME"] + SessionFacade.getApp("subpasta") + "/" + this.Pasta + "/" + fil.Name; dr["caminho"] = arquivo; dr["tamanho"] = fil.Length / 1024; dt.Rows.Add(dr); } return(dt); }
public void verificaAcesso() { if (validaAcesso) { Session.Timeout = 9999; if (SessionFacade.Id.Equals(0) && false) { SessionFacade.Id = 2; SessionFacade.Nome = "Cláudio"; SessionFacade.Contrato = "ABC12345"; SessionFacade.Controle = "O"; SessionFacade.TipoId = 1; //SessionFacade.listaModulos = "ABC12345,TAG548"; //SessionFacade. } if (SessionFacade.Id.Equals(0)) { if (SessionFacade.getApp("usaCookie") != null && SessionFacade.getApp("usaCookie") != String.Empty) { if (Request.Cookies["logado"] != null) { HttpCookie cookie = Request.Cookies["logado"]; if (cookie.Value != String.Empty) { string[] ar = cookie.Value.Split("||".ToCharArray()); SessionFacade.Id = Convert.ToInt32(ar[0]); SessionFacade.Login = ar[1]; SessionFacade.Nome = ar[2]; SessionFacade.listaProcessos = ar[3]; SessionFacade.listaModulos = ar[4]; if (Request.Cookies["_contrato"] != null && Request.Cookies["_contrato"].Value != String.Empty) { Session["_contrato"] = Request.Cookies["_contrato"].Value; } if (Request.Cookies["_controle"] != null && Request.Cookies["_controle"].Value != String.Empty) { Session["_controle"] = Request.Cookies["_controle"].Value; } if (Request.Cookies["TipoId"] != null && Request.Cookies["TipoId"].Value != String.Empty) { Session["TipoId"] = Request.Cookies["TipoId"].Value; } return; } } } } if (SessionFacade.Id.Equals(0)) { //Request.Q if (!isPopup) { Response.Redirect("~/login.aspx"); } else { Utilities.JavaScript.Alert("Sessão expirada!", this.Page); Utilities.JavaScript.ExecuteScript(this.Page, "opener.location.href='login.aspx'; window.close();", true); } } } }
protected void Page_Load(object sender, EventArgs e) { if (SessionFacade.Id <= 0) { if (Request.Cookies["logado"] != null) { HttpCookie cookie = Request.Cookies["logado"]; if (cookie.Value != String.Empty) { // // string ids = SessionFacade.Id.ToString() + "||" + SessionFacade.Nome + "||" + SessionFacade.listaProcessos + // "||" + SessionFacade.listaModulos + "||" + SessionFacade.TextoChamada + "||" + SessionFacade.Email; string[] ar = cookie.Value.Split(new string[] { "||" }, System.StringSplitOptions.None); SessionFacade.Id = Convert.ToInt32(ar[0]); SessionFacade.Login = String.Empty; SessionFacade.Nome = ar[1]; try { // if (ar[2] != String.Empty) // SessionFacade.TipoId = Convert.ToInt32(ar[2]); SessionFacade.listaProcessos = ar[2]; SessionFacade.listaModulos = ar[3]; SessionFacade.TextoChamada = ar[4]; //SessionFacade.Email = ar[5]; } catch { } } } } if (SessionFacade.Id > 0) { string filtroDestinatario = " and ( exists ( select ss.id_mensagem from mensagem_destino ss where ss.id_destinatario = " + SessionFacade.Id.ToString() + " and ss.id_mensagem = m.id and ifNull(ss.arquivada,0) = 0 ) or m.todos = 1 ) "; string sqlcont = " select count(*) from mensagem m where 1 = 1 " + filtroDestinatario + " and m.id not in ( select id_mensagem from mensagem_destino where id_destinatario =" + SessionFacade.Id.ToString() + " and data_lida is not null ) "; int qtdeMensagensNaoLidas = Convert.ToInt32(DataAccess.ConnAccess.fetchData(DataAccess.ConnAccess.getConn(), sqlcont)); a_msg.InnerHtml = "- Mensagens (" + qtdeMensagensNaoLidas.ToString() + ") "; if (qtdeMensagensNaoLidas > 0) { a_msg.Attributes.Remove("style"); a_msg.Attributes.Add("style", "color: orange"); } else { a_msg.Attributes.Remove("style"); a_msg.Attributes.Add("style", "color: blue"); } //a_msg } if (SessionFacade.getApp("NaoConfereAcesso") == "1") { } else { if (SessionFacade.Id <= 0) { //Response.Redirect("login.aspx"); } } string urlAtual = Request.ServerVariables["URL"].ToString(); SessionFacade.TelaAtual = urlAtual; Control txPesquisar = encontraControles(this.Page.Form, "txtPesquisar"); Control imgPesq = encontraControles(this.Page.Form, "imgRefreshFiltro"); if (txPesquisar != null && imgPesq != null) { //this.setEnter((TextBox)txPesquisar, (ImageButton)imgPesq); } //Informa em que módulo o sistema se encontra. string mod = "Entretenimento"; if (Request.QueryString["modulo"] != null && Request.QueryString["modulo"].ToString() != String.Empty) { SessionFacade.Modulo = Request.QueryString["modulo"].ToString(); } //setInputSpeech_control(this.form1); //carregaMenuSistema(); lb_usuario.Text = SessionFacade.Nome; lb_perfil.Text = "(" + SessionFacade.TextoChamada + ") "; if (!Page.IsPostBack) { // UcFiltroBasico1.CaminhoExcel = // Server.MapPath("estrutura_banco.xls"); } }