protected void cmdBuscar_Click(object sender, EventArgs e)
    {
        ReingresoBE r = new ReingresoBE();
        r.zonaCodigo = (txtZonaCodigo.Text.Trim().Length == 0) ? null : txtZonaCodigo.Text;
        r.regionCodigo = (txtRegionCodigo.Text.Trim().Length == 0) ? null : txtRegionCodigo.Text;
        r.estadoVerificadoInt = Convert.ToInt32(ddlEstadoVerificado.SelectedValue);

        try
        {
            List<ReingresoBE> listado = new List<ReingresoBE>();
            listado = reingresoBL.obtenerPorZonaRegion(r);

            gvReingreso.DataSource = listado;
            gvReingreso.DataBind();
            if (listado.Count == 0)
            {
                cmdExportarExcel.Enabled = false;
                divMensaje.InnerHtml = "<div id=\"error\">No se encontraron coincidencias.</div>";
            }
            else
            {
                cmdExportarExcel.Enabled = true;
                divMensaje.InnerHtml = "";
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void cmdBuscar_Click(object sender, EventArgs e)
    {
        //obtenerPorParametros(String , String , String , String , bool )
        //String regionCodigo = txtRegion.Text;
        //String zonaCodigo = txtZona.Text;
        String regionCodigo = lblRegionCodigo.Text;
        String zonaCodigo = lblZonaCodigo.Text;
        //
        String fechaInscripcion = txtFechaInscripcion.Text;
        String campanhaInscripcion = txtCampaniaInscripcion.Text;
        String numeroDocumento = txtDocumentoIdentidad.Text;
        String consultoraCodigo = txtCodigoConsultora.Text;
        String apellidoPaterno = txtApellidoPaterno.Text;
        String apellidoMaterno = txtApellidoMaterno.Text;
        String nombres = txtNombres.Text;
        int estadoVerificado = Convert.ToInt32(ddlEstadoVerificado.SelectedValue);

        try
        {
            ReingresoBE reingresoBE = new ReingresoBE();
            reingresoBE.regionCodigo = regionCodigo;
            reingresoBE.zonaCodigo = zonaCodigo;
            reingresoBE.recFechaReingreso = fechaInscripcion;
            //reingresoBE.Fecha = fechaInscripcion;
            reingresoBE.campanhaInscripcion = campanhaInscripcion;
            reingresoBE.documentoNumero = numeroDocumento;
            reingresoBE.consultoraCodigo = consultoraCodigo;
            reingresoBE.apellidoPaterno = apellidoPaterno;
            reingresoBE.apellidoMaterno = apellidoMaterno;
            reingresoBE.nombres = nombres;
            reingresoBE.estadoVerificadoInt = estadoVerificado;
            //reingresoBE.ModoGrabacionInt = modoGrabacion;
            //apellidoPaterno, apellidoMaterno, nombres, estadoVerificado, modoGrabacion);
            //incorporacionBL.obtenerPorParametros(regionCodigo, zonaCodigo, fechaInscripcion, campanhaInscripcion, numeroDocumento, consultoraCodigo, apellidoPaterno, apellidoMaterno, nombres, estadoVerificado, modoGrabacion);

            List<ReingresoBE> listado = new List<ReingresoBE>();
            listado = reingresosBL.obtenerPorParametros(reingresoBE);

            gvReingresos.DataSource = listado;
            gvReingresos.DataBind();
            if (listado.Count == 0)
            {
                divMensaje.InnerHtml = "<div id=\"error\">No se encontraron coincidencias.</div>";
            }
            else
            {
                divMensaje.InnerHtml = "";
            }

        }
        catch (Exception ex)
        {
            System.Windows.Forms.MessageBox.Show(ex.Message);
        }
    }
Beispiel #3
0
    public XmlDocument RegistroReingreso(
        string APPID,
        string IDPAIS,
        string PIN,
        string IMSI,
        string CODIGOZONA,
        string CAMPANHA,
        string FECHA,
        string CODIGOCONSULTORA,
        string NOMBRES,
        string APELLIDOPATERNO,
        string APELLIDOMATERNO,
        string NRODOCUMENTO,
        string TELEFONO1,
        string TELEFONO2,
        string RECORD_FECHAVISITA,
        string RECORD_OBSERVACION,
        string RECORD_PIN,
        string RECORD_IMSI,
        string RECORD_LONGITUD,
        string RECORD_LATITUD,
        string RECORD_MARGEN,
        string RECORD_NROSATELITES
        )
    {
        string resultado = "";

        if (APPID.Equals(con.APPID()))
        {
            ReingresoBE r = new ReingresoBE();

            r.paisID = Convert.ToInt32(IDPAIS);
            r.Pin = PIN;
            r.Imsi = IMSI;
            r.zonaCodigo = CODIGOZONA;
            r.Campanha = CAMPANHA;
            r.Fecha = FECHA;
            r.consultoraCodigo = CODIGOCONSULTORA;
            r.nombres = NOMBRES;
            r.apellidoPaterno = APELLIDOPATERNO;
            r.apellidoMaterno = APELLIDOMATERNO;
            r.documentoNumero = NRODOCUMENTO;
            r.telefono1 = TELEFONO1;
            r.telefono2 = TELEFONO2;
            r.recPin = RECORD_PIN;
            r.recImsi = RECORD_IMSI;
            r.recLongitud = RECORD_LONGITUD;
            r.recLatitud = RECORD_LATITUD;
            r.recMargen = RECORD_MARGEN;
            r.recNumeroSatelites = Convert.ToInt32(RECORD_NROSATELITES);
            r.recObservacion = RECORD_OBSERVACION;
            r.recFechaVisita = RECORD_FECHAVISITA;

            try
            {
                resultado = reingresoBL.ws_registroReingreso(r, APPID);
                if(resultado.Split('|')[0]=="1") enviaCorreoReingreso(r);
            }
            catch (Exception ex)
            {
                Log.lanzarError(ex);
                resultado = "100|"+ ex.Message;
            }

        }
        else
            resultado = "101|No existe el código APPID";
        return crearXml(resultado);
    }
Beispiel #4
0
    public void enviaCorreoReingreso(ReingresoBE r)
    {
        String usuariosmtp = "", clavesmtp = "", hostsmtp = "", emailorigen = "";
        int puertosmtp = 25;
        Correo correo = new Correo();
        SmtpClient smtp = new SmtpClient();
        MailMessage Mensaje = new MailMessage();
        Attachment Anexo;

        try
        {

            usuariosmtp = ConfigurationManager.AppSettings["usuariosmtp"];
            clavesmtp = ConfigurationManager.AppSettings["clavesmtp"];
            puertosmtp = Convert.ToInt32(ConfigurationManager.AppSettings["puertosmtpssl"]); ;
            hostsmtp = ConfigurationManager.AppSettings["hostsmtp"];
            emailorigen = ConfigurationManager.AppSettings["emailorigen"];

            if (usuariosmtp != "" && clavesmtp != "")
            {
                smtp.Credentials = new NetworkCredential(usuariosmtp, clavesmtp);
                smtp.EnableSsl = true;
            }

            smtp.Port = puertosmtp;
            smtp.Host = hostsmtp;
            Mensaje.Subject = "Nuevo Reingreso";
            Mensaje.Body = "Se ha ingresado un reingreso de consultora";
            Mensaje.From = new MailAddress(emailorigen);
            Mensaje.To.Clear();

            DataTable dtCorreo = new DataTable();
            dtCorreo = correo.obtener("", "", 38, r.paisID);
            String cuenta = "";

            foreach (DataRow fila in dtCorreo.Rows)
            {
                cuenta = fila["email"].Equals(DBNull.Value) ? "" : fila["email"].ToString();
                if (cuenta != "")
                {
                    Mensaje.To.Add(cuenta);
                }
            }

            String gzregion = r.zonaCodigo.Substring(0, 2);
            String gzzona = r.zonaCodigo.Substring(2, 4);

            GerenteZona gz = new GerenteZona();
            DataTable dtgz = gz.obtener("", gzregion, gzzona);
            foreach (DataRow drgz in dtgz.Rows)
            {
                Mensaje.To.Add(drgz["email"].ToString());
            }
            Anexo = new Attachment(rutaAnexoReingreso(r.reingresoID));
            Mensaje.Attachments.Add(Anexo);

            smtp.Send(Mensaje);
        }
        catch (Exception ex)
        {
            Log.lanzarError(ex);
        }
        finally
        {

        }

        correo = null;
        smtp = null;
        Mensaje = null;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            lblPaisTipoDocumento.Text = Convert.ToString(Session["paisTipoDocumento"]);

            //String gerenteID = Request.QueryString.Get("gerenteID");
            String regionCodigo = Request.QueryString.Get("regionCodigo");
            String zonaCodigo = Request.QueryString.Get("zonaCodigo");
            int estadoVerificado = Convert.ToInt32(Request.QueryString.Get("estadoVerificado"));

            if (regionCodigo != null && zonaCodigo != null )
            {
                lblRegionCodigo.Text = regionCodigo;
                lblZonaCodigo.Text = zonaCodigo;

                if (estadoVerificado == 1)
                    ddlEstadoVerificado.SelectedIndex = 1;
                else
                    ddlEstadoVerificado.SelectedIndex = 2;

                ReingresoBE reingresoBE = new ReingresoBE();
                //incorporacionBL.obtenerPorParametros(regionCodigo, zonaCodigo, null, null, null, null, null, null, null, estadoVerificado, 2);
                //reingresoBE.Fecha = "";
                reingresoBE.regionCodigo = regionCodigo;
                reingresoBE.zonaCodigo = zonaCodigo;
                reingresoBE.estadoVerificadoInt = estadoVerificado;
                reingresoBE.recFechaReingresoIni="";
                reingresoBE.recFechaReingresoFin = "";

                List<ReingresoBE> listado = new List<ReingresoBE>();
                listado = reingresosBL.obtenerPorParametros(reingresoBE);
                gvReingresos.DataSource = listado;
                gvReingresos.DataBind();
                if (listado.Count == 0)
                {
                    divMensaje.InnerHtml = "<div id=\"error\">No se encontraron coincidencias.</div>";
                }
                else
                {
                    divMensaje.InnerHtml = "";
                }

            }
        }
    }
    private void fillElements()
    {
        ReingresoBE r = new ReingresoBE();
        r.regionCodigo = (txtRegion.Text.Trim().Length == 0) ? null : txtRegion.Text.Trim();
        r.zonaCodigo = (txtZona.Text.Trim().Length == 0) ? null : txtZona.Text.Trim();

        //r.recFechaReingreso = (txtFechaReingreso.Text.Trim().Length == 0) ? null : txtFechaReingreso.Text.Trim();
        r.recFechaReingresoIni = txtFechaReingresoIni.Text;
        r.recFechaReingresoFin = txtFechaReingresoFin.Text;

        r.campanhaInscripcion = (txtCampanhaInscripcion.Text.Trim().Length == 0) ? null : txtCampanhaInscripcion.Text.Trim();
        r.campanhaPrimeraCompra = (txtCampanhaFacturacion.Text.Trim().Length == 0) ? null : txtCampanhaFacturacion.Text.Trim();
        r.documentoNumero = (txtDocumentoIdentidad.Text.Trim().Length == 0) ? null : txtDocumentoIdentidad.Text.Trim();
        r.consultoraCodigo = (txtConsultoraCodigo.Text.Trim().Length == 0) ? null : txtConsultoraCodigo.Text.Trim();
        r.apellidoPaterno = (txtApellidoPaterno.Text.Trim().Length == 0) ? null : txtApellidoPaterno.Text.Trim();
        r.apellidoMaterno = (txtApellidoMaterno.Text.Trim().Length == 0) ? null : txtApellidoMaterno.Text.Trim();
        r.nombres = (txtNombres.Text.Trim().Length == 0) ? null : txtNombres.Text.Trim();

        r.estadoVerificadoInt = Convert.ToInt32(ddlEstadoVerificado.SelectedValue);
        if (r.estadoVerificadoInt < 2)
            r.estadoVerificado = Convert.ToBoolean(Convert.ToInt32(ddlEstadoVerificado.SelectedValue));

        try
        {
            listado = new List<ReingresoBE>();
            listado = reingresoBL.obtenerPorParametros(r);

        }
        catch (Exception ex)
        {
            //System.Windows.Forms.MessageBox.Show(ex.Message);
        }
    }
Beispiel #7
0
        public List<ReingresoBE> obtenerPorParametros(ReingresoBE reingresoBE)
        {
            List<ReingresoBE> listado = new List<ReingresoBE>();

            DataTable dt = new DataTable("ListadoReingresos");
            SqlDataAdapter da = new SqlDataAdapter();
            SqlConnection cn = new SqlConnection(connection.getConnectionString());

            try
            {
                cn.Open();
                da = new SqlDataAdapter("usp_bel_reingreso_obtener", cn);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;

                //String regionCodigo, String zonaCodigo, String fechaReingreso, String campanhaInscripcion, String campanhaFacturacion, String numeroDocumento, String consultoraCodigo, String apellidoPaterno, String apellidoMaterno, String nombres, bool estado

                da.SelectCommand.Parameters.Add("@regionCodigo", SqlDbType.VarChar, 2).Value = reingresoBE.regionCodigo;
                da.SelectCommand.Parameters.Add("@zonaCodigo", SqlDbType.VarChar, 6).Value = reingresoBE.zonaCodigo;

                DateTime fechaProcesada = new DateTime();
                CultureInfo culture = new CultureInfo("en-GB");
                if (reingresoBE.recFechaReingreso != null)
                {
                    if (reingresoBE.recFechaReingreso.Length > 0)
                    {
                        try
                        {
                            fechaProcesada = Convert.ToDateTime(reingresoBE.recFechaReingreso, culture);
                        }
                        catch (Exception ex)
                        {
                            fechaProcesada = DateTime.Now;
                        }
                    }
                    da.SelectCommand.Parameters.Add("@fechaReingreso", SqlDbType.SmallDateTime).Value = (reingresoBE.recFechaReingreso.Length == 0) ? Convert.DBNull : fechaProcesada;

                }else{
                    da.SelectCommand.Parameters.Add("@fechaReingreso", SqlDbType.SmallDateTime).Value = Convert.DBNull;

                }

                da.SelectCommand.Parameters.Add("@campanhaInscripcion", SqlDbType.VarChar, 6).Value = reingresoBE.campanhaInscripcion;
                da.SelectCommand.Parameters.Add("@campanhaFacturacion", SqlDbType.VarChar, 6).Value = reingresoBE.campanhaPrimeraCompra;
                da.SelectCommand.Parameters.Add("@documentoNumero", SqlDbType.VarChar, 18).Value = reingresoBE.documentoNumero;
                da.SelectCommand.Parameters.Add("@consultoraCodigo", SqlDbType.VarChar, 15).Value = reingresoBE.consultoraCodigo;
                da.SelectCommand.Parameters.Add("@apellidoPaterno", SqlDbType.VarChar, 30).Value = reingresoBE.apellidoPaterno;
                da.SelectCommand.Parameters.Add("@apellidoMaterno", SqlDbType.VarChar, 30).Value = reingresoBE.apellidoMaterno;
                da.SelectCommand.Parameters.Add("@nombres", SqlDbType.VarChar, 30).Value = reingresoBE.nombres;

                if (reingresoBE.estadoVerificadoInt > 1)
                    da.SelectCommand.Parameters.Add("@estadoVerificado", SqlDbType.Bit).Value = DBNull.Value;
                else
                    da.SelectCommand.Parameters.Add("@estadoVerificado", SqlDbType.Bit).Value = Convert.ToBoolean(reingresoBE.estadoVerificadoInt);

                da.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    ReingresoBE r;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        r = new ReingresoBE();

                        r.reingresoID = Convert.ToInt32(dt.Rows[i]["reingresoID"]);
                        r.regionCodigo = Convert.ToString(dt.Rows[i]["regionCodigo"]).Trim();
                        r.zonaCodigo = Convert.ToString(dt.Rows[i]["zonaCodigo"]).Trim();
                        if (dt.Rows[i]["fechaReingreso"].Equals(DBNull.Value))
                        {
                            r.Fecha = "";
                        }else{
                            r.Fecha = DateFormatter.getShortTime(Convert.ToDateTime(dt.Rows[i]["fechaReingreso"])); //Convert.ToString(dt.Rows[i]["fechaReingreso"]).Trim();
                        }
                        //r.recFechaReingreso = DateFormatter.getShortTime(Convert.ToDateTime(dt.Rows[i]["fechaReingreso"]));
                        r.campanhaInscripcion = Convert.ToString(dt.Rows[i]["campanhaInscripcion"]).Trim();
                        r.campanhaPrimeraCompra = Convert.ToString(dt.Rows[i]["campanhaPrimeraCompra"]).Trim();
                        r.documentoNumero = Convert.ToString(dt.Rows[i]["documentoNumero"]).Trim();
                        r.consultoraCodigo = Convert.ToString(dt.Rows[i]["consultoraCodigo"]).Trim();
                        r.apellidoPaterno = Convert.ToString(dt.Rows[i]["apellidoPaterno"]).Trim();
                        r.apellidoMaterno = Convert.ToString(dt.Rows[i]["apellidoMaterno"]).Trim();
                        r.nombres = Convert.ToString(dt.Rows[i]["nombres"]).Trim();
                        r.estadoActivo = Convert.ToBoolean(dt.Rows[i]["estadoActivo"]);
                        r.estadoVerificado = Convert.ToBoolean(dt.Rows[i]["estadoVerificado"]);
                        r.estadoVerificadoString = (r.estadoVerificado) ? "Si" : "No";
                        listado.Add(r);
                    }
                }
            }
            catch (Exception ex)
            {
                listado = null;
            }
            finally
            {
                da.Dispose();
                dt.Dispose();

                cn.Close();
                cn.Dispose();
            }

            return listado;
        }
Beispiel #8
0
        public String ws_registroReingreso(ReingresoBE r, String appID)
        {
            String resultado = "";
            SqlCommand cmd = new SqlCommand();
            SqlConnection cn = new SqlConnection(connection.getConnectionString());

            try
            {
                cn.Open();
                cmd = new SqlCommand("SP_WS_REGISTRO_REINGRESO", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Transaction = cn.BeginTransaction();

                cmd.Parameters.Add("@APPID", SqlDbType.VarChar, 19).Value = appID;
                cmd.Parameters.Add("@IDPAIS", SqlDbType.Int).Value = r.paisID;
                cmd.Parameters.Add("@PIN", SqlDbType.VarChar, 20).Value = r.Pin;
                cmd.Parameters.Add("@IMSI", SqlDbType.VarChar, 20).Value = r.Imsi;
                cmd.Parameters.Add("@CODIGOZONA", SqlDbType.VarChar, 6).Value = r.zonaCodigo;
                cmd.Parameters.Add("@CAMPANHA", SqlDbType.VarChar, 6).Value = r.Campanha;
                cmd.Parameters.Add("@FECHA", SqlDbType.VarChar, 12).Value = r.Fecha;
                cmd.Parameters.Add("@CODIGOCONSULTORA", SqlDbType.VarChar, 15).Value = r.consultoraCodigo;
                cmd.Parameters.Add("@NOMBRES", SqlDbType.VarChar, 30).Value = r.nombres;
                cmd.Parameters.Add("@APELLIDOPATERNO", SqlDbType.VarChar, 30).Value = r.apellidoPaterno;
                cmd.Parameters.Add("@APELLIDOMATERNO", SqlDbType.VarChar, 30).Value = r.apellidoMaterno;
                cmd.Parameters.Add("@NRODOCUMENTO", SqlDbType.Char, 18).Value = r.documentoNumero;
                cmd.Parameters.Add("@RECORD_PIN", SqlDbType.VarChar, 20).Value = r.recPin;
                cmd.Parameters.Add("@RECORD_IMSI", SqlDbType.VarChar, 20).Value = r.recImsi;
                cmd.Parameters.Add("@RECORD_LONGITUD", SqlDbType.VarChar, 20).Value = r.recLongitud;
                cmd.Parameters.Add("@RECORD_LATITUD", SqlDbType.VarChar, 20).Value = r.recLatitud;
                cmd.Parameters.Add("@RECORD_MARGEN", SqlDbType.VarChar, 9).Value = r.recMargen;
                cmd.Parameters.Add("@RECORD_NROSATELITES", SqlDbType.Int).Value = r.recNumeroSatelites;
                cmd.Parameters.Add("@RECORD_OBSERVACION", SqlDbType.VarChar, 200).Value = r.recObservacion;
                cmd.Parameters.Add("@RECORD_FECHAVISITA", SqlDbType.VarChar, 12).Value = r.recFechaVisita;

                SqlDataReader reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    reader.Read();
                    resultado = reader.GetString(0) + reader.GetString(1);
                }

                reader.Close();

                cmd = new SqlCommand("SELECT max(id) from tb_reingreso", cn);
                r.reingresoID = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                resultado = "0|" + ex.Message;
                //cmd.Transaction.Rollback();
            }
            finally
            {
                cn.Close();
                cmd.Dispose();
                cn.Dispose();
            }

            return resultado;
        }
Beispiel #9
0
        public List<ReingresoBE> obtenerPorZonaRegion(ReingresoBE reingresoBE)
        {
            List<ReingresoBE> listado = new List<ReingresoBE>();

            DataTable dt = new DataTable("ListadoReingresosPorZonaRegion");
            SqlDataAdapter da = new SqlDataAdapter();
            SqlConnection cn = new SqlConnection(connection.getConnectionString());

            try
            {
                cn.Open();
                da = new SqlDataAdapter("usp_bel_reingreso_obtener_por_region_zona", cn);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;

                da.SelectCommand.Parameters.Add("@regionCodigo", SqlDbType.VarChar, 2).Value = reingresoBE.regionCodigo;
                da.SelectCommand.Parameters.Add("@zonaCodigo", SqlDbType.VarChar, 6).Value = reingresoBE.zonaCodigo;

                if (reingresoBE.estadoVerificadoInt > 1)
                    da.SelectCommand.Parameters.Add("@estadoVerificiado", SqlDbType.Bit).Value = DBNull.Value;
                else
                    da.SelectCommand.Parameters.Add("@estadoVerificiado", SqlDbType.Bit).Value = Convert.ToBoolean(reingresoBE.estadoVerificadoInt);

                da.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    ReingresoBE r;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        r = new ReingresoBE();

                        //r.gerenteZonaID = Convert.ToInt32(dt.Rows[i]["gerenteID"]);
                        r.regionCodigo = Convert.ToString(dt.Rows[i]["regionCodigo"]).Trim();
                        r.zonaCodigo = Convert.ToString(dt.Rows[i]["zonaCodigo"]).Trim();
                        r.estadoVerificado = Convert.ToBoolean(dt.Rows[i]["estadoVerificado"]);
                        r.estadoVerificadoString = (r.estadoVerificado) ? "Si" : "No";
                        r.cantidad = Convert.ToInt32(dt.Rows[i]["cantidad"]);
                        listado.Add(r);
                    }
                }
            }
            catch (Exception ex)
            {
                listado = null;
            }
            finally
            {
                da.Dispose();
                dt.Dispose();

                cn.Close();
                cn.Dispose();
            }

            return listado;
        }
Beispiel #10
0
 public String ws_registroReingreso(ReingresoBE r, String appID)
 {
     return dao.ws_registroReingreso(r, appID);
 }
Beispiel #11
0
 public List<ReingresoBE> obtenerPorZonaRegion(ReingresoBE reingresoBE)
 {
     return dao.obtenerPorZonaRegion(reingresoBE);
 }
Beispiel #12
0
 public List<ReingresoBE> obtenerPorParametros(ReingresoBE reingresoBE)
 {
     return dao.obtenerPorParametros(reingresoBE);
 }