protected void Page_Load(object sender, EventArgs e) { string sUser = UsuarioWeb.GetNomeUsuarioGestorConectado(Session); if (sUser == "") { Response.Redirect("~/Home.aspx"); } if (!Page.IsPostBack) { BaseDAO.CancelarOperacaoObjetoDAO((BaseDAO)Session["ObjetoPedidoDetalhado"]); ParametroPesquisa objParametros = (ParametroPesquisa)Session["FiltroPedidos"]; bool bParametrosValidos = (objParametros != null); if (bParametrosValidos) { bParametrosValidos = (!objParametros.AindaNaoDefiniuFiltro()); } if (!bParametrosValidos) { Response.Redirect("~/Ger_PesquisarPedidos.aspx"); return; } PesquisarDados(objParametros.GetWhere(), objParametros.GetHaving()); } }
protected void Page_Load(object sender, EventArgs e) { try { string sUser = UsuarioWeb.GetNomeUsuarioGestorConectado(Session); if (sUser == "") { Response.Redirect("~/Home.aspx"); } if (!Page.IsPostBack) { txtDataFinal.Text = DateTime.Today.ToShortDateString(); txtDataInicial.Text = (DateTime.Today.AddDays(-10)).ToShortDateString(); UsuarioWeb objUsuario = Session["ObjetoUsuario"] as UsuarioWeb; cbxVendedor.DataTextField = "nm_guerra"; cbxVendedor.DataValueField = "cd_vend"; cbxVendedor.DataSource = objUsuario.oTabelas.hlpDbFuncoes.qrySeekRet("select cd_vend, nm_guerra from vendedor where coalesce(st_acessa_web,'N') = 'S'"); cbxVendedor.DataBind(); } } catch (Exception ex) { throw ex; } }
private void PesquisarDados(string sWhere, string sHaving) { UsuarioWeb objUsuario = (UsuarioWeb)Session["ObjetoUsuario"]; DataTable dtPedidos = (DataTable)Session["DadosConsultaPedidos"]; bool bPesquisarDados = (dtPedidos == null); string sDoc = ""; string stpdocs = objUsuario.oTabelas.hlpDbFuncoes.qrySeekValue("EMPRESA", "DS_TPDOCWEB", "CD_EMPRESA = '" + objUsuario.oTabelas.sEmpresa + "'"); foreach (string item in stpdocs.Split(';')) { string[] tpdoc = item.Split(','); if (tpdoc.Length > 1) { sDoc = tpdoc[1].ToString().Trim(); } } if (bPesquisarDados) { string sUserGestor = UsuarioWeb.GetNomeUsuarioGestorConectado(Session); string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session); StringBuilder str = new StringBuilder(); str.Append("SELECT P.CD_EMPRESA, "); str.Append("P.DT_PEDIDO, "); str.Append("P.CD_PEDIDO, "); str.Append("P.NM_GUERRA "); str.Append("FROM PEDIDO P "); str.Append("LEFT OUTER JOIN MOVITEM MOVI ON (MOVI.CD_EMPRESA = P.CD_EMPRESA) AND (MOVI.CD_PEDIDO = P.CD_PEDIDO) "); str.Append("WHERE (P.CD_EMPRESA = '" + objUsuario.oTabelas.sEmpresa + "') AND "); str.Append("(P.CD_TIPODOC = '" + sDoc + "') AND "); string sReplace = sWhere.Replace("(PEDIDO.CD_VEND1 = '" + objUsuario.CodigoVendedor + "') AND", " "); str.Append(sReplace + " "); str.Append("GROUP BY P.CD_EMPRESA, P.DT_PEDIDO, P.CD_PEDIDO, P.NM_GUERRA "); if (!sHaving.Equals(String.Empty)) { str.Append("HAVING " + sHaving); } dtPedidos = objUsuario.oTabelas.hlpDbFuncoes.qrySeekRet( str.ToString()); DataColumn[] ChavePrimaria = new DataColumn[] { dtPedidos.Columns["CD_PEDIDO"] }; dtPedidos.PrimaryKey = ChavePrimaria; Session["DadosConsultaPedidos"] = dtPedidos; } if (dtPedidos.Rows.Count == 0) { MessageHLP.ShowPopUpMsg("Não existem registros no período selecionado", this.Page); } if (!Page.IsPostBack) { ProcessaDataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sUser = UsuarioWeb.GetNomeUsuarioGestorConectado(Session); if (sUser == "") { Response.Redirect("~/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DateTime dDataFinal = DateTime.Now; txtDataFinal.Text = dDataFinal.ToString("dd/MM/yyyy"); txtDataInicial.Text = (dDataFinal.AddDays(-5).ToString("dd/MM/yyyy")); string sUserGestor = UsuarioWeb.GetNomeUsuarioGestorConectado(Session); if (sUserGestor == "") { Response.Redirect("~/Login.aspx"); } } BaseDAO.CancelarOperacaoObjetoDAO((BaseDAO)Session["ObjetoPedidoDetalhado"]); ParametroPesquisaCapoli.InicializarParametroPesquisa( "FiltroPedidos", "PEDIDO", this.Session); Session["DadosConsultaPedidos"] = null; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sUser = UsuarioWeb.GetNomeUsuarioGestorConectado(Session); UsuarioWeb objUsuario = new UsuarioWeb(); DataTable dtDadosEmpresa = objUsuario.oTabelas.hlpDbFuncoes.qrySeekRet("EMPRESA", "nm_empresa,nm_guerra", "CD_EMPRESA = '" + objUsuario.oTabelas.sEmpresa.Trim() + "'"); // int i = Convert.ToInt32(objUsuario.oTabelas.hlpDbFuncoes.qrySeekRet("SELECT COUNT(*) FROM ACESSO WHERE TP_OPERADO ='WEB' ")); foreach (DataRow row in dtDadosEmpresa.Rows) { lblNmFantasia.Text = "Módulo de Vendas - " + row["nm_guerra"].ToString(); lblNmEmpresa.Text = row["nm_empresa"].ToString(); } if (sUser != "") { string sMessage = string.Empty; int iHour = DateTime.Now.Hour; if (iHour >= 0 && iHour <= 12) { sMessage = "Bom dia {0}"; } else if (iHour > 12 && iHour <= 18) { sMessage = "Boa tarde {0}"; } else { sMessage = "Boa noite {0}"; } lblRepres.Text = string.Format(sMessage, sUser); } else { lblRepres.Text = ""; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sUserGestor = UsuarioWeb.GetNomeUsuarioGestorConectado(Session); string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session); if (sUserGestor == "") { if (sUser == "") { Response.Redirect("~/Home.aspx"); } } rpt.Load(Server.MapPath("rptPedidoComissao.rpt")); rpt.SetDataSource((DataSet)Session["DataSetPedidoComissao"]); CrystalReportViewer1.ReportSource = rpt; GerarPDF(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sUserGestor = UsuarioWeb.GetNomeUsuarioGestorConectado(Session); string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session); if (sUserGestor == "") { if (sUser == "") { Response.Redirect("~/Home.aspx"); } } DataTable TabelaImpressao = (DataTable)Session["DadosConsultaPendencias"]; rpt.Load(Server.MapPath("rptPendenciasCliente.rpt")); rpt.SetDataSource(TabelaImpressao); CrystalReportViewer1.ReportSource = rpt; GerarPDF(); } }