private bool InicializaDadosEMail(string CodEmpresa, string CodMatricula, string NumIdntfRptant, string NumSubMatric, string DatIni, string DatFim, string DatPagamento) { txtEMail.Text = txtEMail.Text.Trim(); if (String.IsNullOrEmpty(txtEMail.Text)) { MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nE-Mail obrigatório"); return(false); } else if (!Util.ValidaEmail(txtEMail.Text)) { MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nE-Mail inválido"); return(false); } CreditoReembolsoBLL CredReeBLL = new CreditoReembolsoBLL(); int iRepresentante = 0; int.TryParse(ddlRepresentante.SelectedValue, out iRepresentante); epDados = CredReeBLL.Consultar(int.Parse(CodEmpresa), int.Parse(CodMatricula), iRepresentante, NumSubMatric, DateTime.Parse(DatIni), DateTime.Parse(DatFim)); if (String.IsNullOrEmpty(epDados.empresa) && String.IsNullOrEmpty(epDados.registro)) { MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nDados não localizados para a matrícula " + CodMatricula); return(false); } ArquivoDownload newAd = new ArquivoDownload(); newAd.nome_arquivo = nome_anexo + DatPagamento.Replace("/", "_") + ".pdf"; newAd.dados = ReportCrystal.ExportarRelatorioPdf(); lstAdPdf.Add(newAd); return(true); }
private void CarregaTela() { CreditoReembolsoBLL CredReeBLL = new CreditoReembolsoBLL(); int iRepresentante = 0; int.TryParse(ddlRepresentante.SelectedValue, out iRepresentante); grdCreditoReembolso.DataSource = CredReeBLL.Listar(int.Parse(txtCodEmpresa.Text), int.Parse(txtCodMatricula.Text), iRepresentante, ddlUsuario.SelectedValue, DateTime.Parse(txtDtIni.Text), DateTime.Parse(txtDtFim.Text)); grdCreditoReembolso.DataBind(); }
private bool ValidarCampos(bool BuscarDados = true) { int CodEmpresa, CodMatricula; DateTime DtIni, DtFim; if (String.IsNullOrEmpty(txtCodEmpresa.Text) || String.IsNullOrEmpty(txtCodMatricula.Text)) { MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nOs campos Empresa e Matrícula são obrigatórios"); ddlUsuario.Items.Clear(); ddlRepresentante.Items.Clear(); return(false); } else if (!int.TryParse(txtCodEmpresa.Text, out CodEmpresa) || !int.TryParse(txtCodMatricula.Text, out CodMatricula)) { MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nCampo Empresa ou Matrícula inválido"); ddlUsuario.Items.Clear(); ddlRepresentante.Items.Clear(); return(false); } if (String.IsNullOrEmpty(txtDtIni.Text) || String.IsNullOrEmpty(txtDtFim.Text)) { MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nOs campos do Período de crédito são obrigatórios"); return(false); } else if (!DateTime.TryParse(txtDtIni.Text, out DtIni) || !DateTime.TryParse(txtDtFim.Text, out DtFim)) { MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nPeríodo de crédito inválido"); return(false); } if (!BuscarDados) { return(true); } CreditoReembolsoBLL CredReeBLL = new CreditoReembolsoBLL(); int iRepresentante = 0; int.TryParse(ddlRepresentante.SelectedValue, out iRepresentante); epDados = CredReeBLL.Consultar(CodEmpresa, CodMatricula, iRepresentante, " ", DtIni, DtFim); if (String.IsNullOrEmpty(epDados.empresa) && String.IsNullOrEmpty(epDados.registro)) { MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nCrédito de reembolso não localizado para a matrícula " + txtCodMatricula.Text); grdCreditoReembolso.DataSource = null; grdCreditoReembolso.DataBind(); grdCreditoReembolso.Visible = true; ifCreditoReembolsoSysDocs.Visible = false; return(false); } return(true); }
private void CarregarUsuarios(int CodEmpresa, int CodMatricula, int CodRepresentante) { CreditoReembolsoBLL CredReeBLL = new CreditoReembolsoBLL(); if ((integracao_crm) && (CodRepresentante == 0)) { CarregaDropDowDT(CredReeBLL.ListarUsuariosCRM(CodEmpresa, CodMatricula, CodRepresentante), ddlUsuario); } else { CarregaDropDowDT(CredReeBLL.ListarUsuarios(CodEmpresa, CodMatricula, CodRepresentante), ddlUsuario); } ddlUsuario.Items[0].Value = " "; ddlUsuario.Items[0].Text = "<TODOS>"; }
protected void Page_Load(object sender, EventArgs e) { string detalhado = Request.QueryString["hidDetalhado"] ?? "false"; string visualizar = Request.QueryString["hidVisualizar"] ?? "false"; string COD_EMPRS = Request.QueryString["nempr"]; string NUM_RGTRO_EMPRG = Request.QueryString["nreg"]; string PARTICIPANTEEMAIL = Request.QueryString["ParticipanteEmail"]; NUM_IDNTF_RPTANT = Util.String2Int32(Request.QueryString["nrepr"]); ScriptManager.RegisterStartupScript(UpdatePanel, UpdatePanel.GetType(), "script", "_client_side_script()", true); Page.Form.DefaultButton = btnPesquisar.UniqueID; if (!IsPostBack) { if (!String.IsNullOrEmpty(COD_EMPRS) && !String.IsNullOrEmpty(NUM_RGTRO_EMPRG)) { //ReportCrystal.Visible = false; txtCodEmpresa.Text = COD_EMPRS; txtCodMatricula.Text = NUM_RGTRO_EMPRG; if (!String.IsNullOrEmpty(PARTICIPANTEEMAIL) && PARTICIPANTEEMAIL != "undefined") { txtEMail.Text = PARTICIPANTEEMAIL; } //txtDtIni.Text = DateTime.Now.AddMonths(-12).ToString("dd/MM/yyyy"); //txtDtFim.Text = DateTime.Now.ToString("dd/MM/yyyy"); CarregarDropDown(); //if (ValidarCampos()) //{ CreditoReembolsoBLL CredReeBLL = new CreditoReembolsoBLL(); int iRepresentante = 0; int.TryParse(ddlRepresentante.SelectedValue, out iRepresentante); grdCreditoReembolso.DataSource = CredReeBLL.Listar(int.Parse(txtCodEmpresa.Text), int.Parse(txtCodMatricula.Text), int.Parse(ddlRepresentante.SelectedValue), ddlUsuario.SelectedValue, DateTime.Now.AddMonths(-2), DateTime.Now); grdCreditoReembolso.DataBind(); grdCreditoReembolso.Visible = true; ifCreditoReembolsoSysDocs.Visible = false; //} } } }
private void CarregarDropDown() { int CodEmpresa, CodMatricula, CodRepresentante; if (int.TryParse(txtCodEmpresa.Text, out CodEmpresa) && int.TryParse(txtCodMatricula.Text, out CodMatricula)) { CreditoReembolsoBLL CredReeBLL = new CreditoReembolsoBLL(); if (ddlRepresentante.Items.Count == 0) { List <UsuarioPortal> lstRepresentantes = CredReeBLL.ConsultarRepresentantes(int.Parse(txtCodEmpresa.Text), int.Parse(txtCodMatricula.Text), NUM_IDNTF_RPTANT ?? 0); if (lstRepresentantes.Count == 0) { lstRepresentantes = CredReeBLL.ConsultarRepresentantes(int.Parse(txtCodEmpresa.Text), int.Parse(txtCodMatricula.Text), null); } if (lstRepresentantes.Count > 0) { CarregaDropDowList(ddlRepresentante, lstRepresentantes.ToList <object>(), "NomeCompleto", "NUM_IDNTF_RPTANT"); ddlRepresentante.Items.RemoveAt(0); if (lstRepresentantes.Count < 2) { ddlRepresentante.SelectedIndex = 0; } } else { DataTable dt = CredReeBLL.ListarUsuarios(int.Parse(txtCodEmpresa.Text), int.Parse(txtCodMatricula.Text), 0); if (dt.Rows.Count > 0) { CarregaDropDowDT(dt, ddlRepresentante); ddlRepresentante.Items.RemoveAt(0); ddlRepresentante.SelectedIndex = 0; } } } if (ddlUsuario.Items.Count == 0 && int.TryParse(ddlRepresentante.SelectedValue, out CodRepresentante)) { CarregarUsuarios(CodEmpresa, CodMatricula, CodRepresentante); } } }
private string Solicita_URL_SysDocs(int BdTypeName) { CreditoReembolsoBLL CredReeBLL = new CreditoReembolsoBLL(); int iRepresentante = 0; int.TryParse(ddlRepresentante.SelectedValue, out iRepresentante); List <UsuarioPortal> usPortal = CredReeBLL.ConsultarRepresentantes(int.Parse(txtCodEmpresa.Text), int.Parse(txtCodMatricula.Text), iRepresentante); string fullUrl = ""; if (usPortal.Count > 0) { UsuarioPortal userPortal = usPortal[0]; DateTime dtIni, dtFim; DateTime.TryParse(txtDtIni.Text, out dtIni); DateTime.TryParse(txtDtFim.Text, out dtFim); string cp01 = userPortal.COD_EMPRS.ToString().PadLeft(3, '0'); //empresaFormat.format(dcVo.getEmpresa()); string cp02 = userPortal.NUM_RGTRO_EMPRG.ToString().PadLeft(10, '0'); //matriculaFormat.format(dcVo.getMatricula()); string cp03 = userPortal.NUM_DIGVR_EMPRG.ToString(); string cp04 = dtIni.Year.ToString(); //anoInicio; string cp05 = dtFim.Year.ToString(); //anoFim; string cp06 = dtIni.Month.ToString(); //mesInicio; string cp07 = dtFim.Month.ToString(); //mesFim; string cp08 = userPortal.NomeCompleto.ToString().Trim().Replace(' ', '_'); //"0"; //dcVo.getNome().replace(' ', '_'); string cp09 = userPortal.CPF.ToString(); //0; //dcVo.getCpf(); string strUrl = String.Format("https://docs.prevcesp.com.br/ged/idocs_portal_ticket.php?BdTypeName={0}&CP01={1}&CP02={2}&CP03={3}&CP04={4}&CP05={5}&CP06={6}&CP07={7}&CP08={8}&CP09={9}", BdTypeName, cp01, cp02, cp03, cp04, cp05, cp06, cp07, cp08, cp09); try { WebRequest request = WebRequest.Create(strUrl); request.Credentials = CredentialCache.DefaultCredentials; WebResponse response = request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); if (responseFromServer.Split('|').Length > 1) { string token = responseFromServer.Split('|')[1]; fullUrl = "https://docs.prevcesp.com.br/ged/idocs_portal_procrel.php?ticket=" + token; } reader.Close(); response.Close(); } catch (Exception ex) { MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nErro ao consultar o Sysdocs.\\nMotivo:\\n" + ex.Message); } } else { MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nSysDoc não disponível para esta Empresa e Matrícula"); } return(fullUrl); }