Example #1
0
        private void CarregarDropDown()
        {
            int CodEmpresa, CodMatricula, CodRepresentante;

            if (int.TryParse(txtCodEmpresa.Text, out CodEmpresa) && int.TryParse(txtCodMatricula.Text, out CodMatricula))
            {
                ExtratoUtilizacaoBLL CredReeBLL = new ExtratoUtilizacaoBLL();

                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);
                            for (int i = 0; i < ddlRepresentante.Items.Count; i++)
                            {
                                ddlRepresentante.Items[i].Value = "0";
                            }
                            ddlRepresentante.SelectedIndex = 0;
                        }
                    }
                }
            }
        }
Example #2
0
        private string Solicita_Consulta_GED_CRM(int BdTypeName)
        {
            ExtratoUtilizacaoBLL CredReeBLL = new ExtratoUtilizacaoBLL();
            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();              //"0"; //dcVo.getNome().replace(' ', '_');
                string cp09 = userPortal.CPF.ToString();                              //0; //dcVo.getCpf();
                string cp10 = txtEMail.Text;
                string cp11 = "";
                string cp12 = "";
                string cp13 = "F";

                fullUrl = String.Format("http://fcespwebp001/Consulta_GED_CRM/Consulta.aspx?BdTypeName={0}&CP01={1}&CP02={2}&CP03={3}&CP04={4}&CP05={5}&CP06={6}&CP07={7}&CP08={8}&CP09={9}&CP10={10}&CP10={13}",
                                        BdTypeName,
                                        cp01, cp02, cp03,
                                        cp04, cp05, cp06,
                                        cp07, cp08, cp09,
                                        cp10, cp11, cp12,
                                        cp13);

                //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(fullUrl);
                    request.Credentials = CredentialCache.DefaultCredentials;
                    WebResponse  response           = request.GetResponse();
                    Stream       dataStream         = response.GetResponseStream();
                    StreamReader reader             = new StreamReader(dataStream);
                    string       responseFromServer = reader.ReadToEnd();

                    if (responseFromServer.ToUpper().Contains("NENHUM ARQUIVO ENCONTRADO"))
                    {
                        fullUrl = "";
                    }

                    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);
        }