Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Documento_existe.Attributes.Add("style", "DISPLAY: none");
        Correo_existe.Attributes.Add("style", "DISPLAY: none");
        ApagarTimer.Attributes.Add("style", "DISPLAY: none");


        if (Session["id_persona"] == null)
        {
            ctr_persona = new CtrPersona();
            string html = string.Format(@"
               <div id='iniciar_sesion' class='btn-group' role='group'>
                   <button class='btn btn-primary' type='button' id='iniciar_sesion' data-toggle='modal' data-target='#IniciarSesion' aria-haspopup='true' aria-expanded='false' runat='server' >
                    <i class='material-icons'> perm_identity</i> Iniciar Sesión / Registrarse
                   </button>                               
               </div> '");
            this.Literal1.Text = html;
        }
        else
        {
            string usuario = Session["id_persona"].ToString();
            if (!IsPostBack)
            {
                int perfil = int.Parse(Session["id_perfil"].ToString());
                switch (perfil)
                {
                case Constante.ROL_ADMINISTRADOR:
                    perfil_administrador();
                    break;

                case Constante.ROL_JEFE_DE_VENTAS:
                    perfil_jefe_de_ventas();
                    break;

                case Constante.ROL_JEFE_DE_COMPRAS:
                    perfil_jefe_de_compras();
                    break;

                case Constante.ROL_PROVEEDOR:
                    perfil_proveedor();
                    break;

                case Constante.ROL_CLIENTE:
                    perfil_cliente();
                    break;

                default:
                    Session.Clear();
                    Session.Abandon();
                    Response.Redirect("../../inicio.aspx");
                    break;
                }
                //divName.InnerHtml = Session["nombre"].ToString();
                //divEmail.InnerHtml = Session["correo"].ToString();
            }
        }
    }
Ejemplo n.º 2
0
        private bool AgregarNuevoUsuarioPersona()
        {
            bool valido = false;

            try
            {
                ClassResultV cr   = new ClassResultV();
                DtoUsuario   dtoU = new DtoUsuario();
                DtoPersona   dtoP = new DtoPersona();
                //Usuario
                dtoU.codPerfil         = Convert.ToInt32(ddlPerfilAdd.SelectedValue);
                dtoU.usuario           = txtUsuarioPersona.Text.Trim();
                dtoU.usuarioClave      = txtUsuarioContrasenia.Text.Trim();
                dtoU.usuarioNombre     = txtNombrePers.Text.Trim();
                dtoU.usuarioApePaterno = txtApellidoPatPers.Text.Trim();
                dtoU.usuarioApeMaterno = txtApellidoMatPers.Text.Trim();
                dtoU.usuarioCorreo     = txtCorreoPersona.Text.Trim();
                dtoU.usuarioDireccion  = txtDireccionPersona.Text.Trim();
                dtoU.usuarioNumDNI     = Convert.ToInt32(txtNumDNIPersona.Text.Trim());
                dtoU.usuarioTelefono   = Convert.ToInt32(txtTelefonoPersona.Text.Trim());
                dtoU.usuarioEstado     = "1";
                dtoU = new CtrUsuario().Usp_Usuario_Insert(dtoU);
                //Persona
                dtoP.codUsuario        = dtoU.codUsuario;
                dtoP.personaNombre     = txtNombrePers.Text.Trim();
                dtoP.personaApePaterno = (txtApellidoPatPers.Text.Trim());
                dtoP.personaApeMaterno = txtApellidoMatPers.Text.Trim();
                dtoP.personaFechaNac   = Convert.ToDateTime(txtFechaNacPersona.Text.Trim());
                dtoP.personaNumDNI     = Convert.ToInt32(txtNumDNIPersona.Text.Trim());
                dtoP.personaTelefono   = Convert.ToInt32(txtTelefonoPersona.Text.Trim());
                dtoP.personaCorreo     = txtCorreoPersona.Text.Trim();
                dtoP.personaDireccion  = txtDireccionPersona.Text.Trim();

                dtoP = new CtrPersona().Usp_Persona_Insert(dtoP);
                if (!cr.HuboError)
                {
                    Response.Write("<script>alert('Usuario Personal Registrada Correctamente')</script>");
                    Limpiar();
                }
                else
                {
                    Response.Write("<script>alert('" + cr.ErrorMsj + "')</script>");
                }
            }
            catch (Exception ex)
            {
            }
            return(valido);
        }
Ejemplo n.º 3
0
        protected void iniciarSesion(object sender, EventArgs e)
        {
            string usuario    = txtUsuario.Text;
            string contraseña = txtContraseña.Text;

            if (usuario.Length == 0 || contraseña.Length == 0)
            {
                Response.Write("<script>alert('Debe llenar campos Usuario y Contraseña')</script>");
            }
            else
            {
                DtoPersona pers = new DtoPersona();
                DtoUsuario user = new DtoUsuario();
                user.usuario = usuario;
                user.clave   = contraseña;

                CtrUsuario neguser = new CtrUsuario();
                if (neguser.consultarUsuario(user))
                {
                    neguser.consultarUsuario(user);

                    if (user.estado == "True")
                    {
                        pers.codUsuario = user.codUsuario;
                        CtrPersona negpers = new CtrPersona();
                        negpers.consultarPersonaxcodUsuario(pers);

                        Session["id_user"]     = user.codUsuario;
                        Session["perfil_user"] = user.codPerfil;
                        Session["nombre_user"] = pers.nombres + " " + pers.apPaterno + " " + pers.apMaterno;
                        Session["id_persona"]  = pers.codPersona;

                        Response.Redirect("SesionUsuario.aspx");
                    }
                    else
                    {
                        Response.Write("<script>alert('Usted no esta habilitado para ingresar a la aplicación')</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('Usuario y/o Contraseña incorrecto, Verificar')</script>");
                }
            }
        }
        public DataTable evaluarNivel(DataSet dsTalleres)
        {
            CtrPersona obj = new CtrPersona();

            nivel.Text = obj.consultarAlumno(int.Parse(prueba.Text));

            DataTable dtaux = dsTalleres.Tables[0].Clone();

            foreach (DataTable thisTable in dsTalleres.Tables)
            {
                foreach (DataRow row in thisTable.Rows)
                {
                    if (row["nivel"].ToString().Contains(nivel.Text.ToString()))
                    {
                        dtaux.ImportRow(row);
                    }
                }
            }
            return(dtaux);
        }
        public void listarTalleresAperturados()
        {
            CtrPersona negper = new CtrPersona();


            DataSet dsAux = negper.listarTalleres(int.Parse(prueba.Text));

            DataTable dsTalleres = evaluarNivel(dsAux);

            gv_talleresaperturados.DataSource = dsTalleres;
            gv_talleresaperturados.DataBind();

            if (gv_talleresaperturados.Rows.Count == 0)
            {
                lblmensaje.Text = "No se encontró profesores";
            }
            else
            {
                lblmensaje.Text = "";
            }
        }
Ejemplo n.º 6
0
        public void cargarDatos()
        {
            CtrProfesor   ctrprof = new CtrProfesor();
            CtrTrabajador ctrtrab = new CtrTrabajador();
            CtrPersona    ctrpers = new CtrPersona();
            DtoProfesor   prof    = new DtoProfesor();
            CtrUbigeo     ctrubig = new CtrUbigeo();

            prof.codPersona = int.Parse(Session["c"].ToString());

            ctrpers.consultarPersona(prof);
            ctrtrab.consultarTrabajador(prof);
            ctrprof.consultarProfesor(prof);

            txtNombres.Text       = prof.nombres;
            txtApPAt.Text         = prof.apPaterno;
            txtApMat.Text         = prof.apMaterno;
            txtNumDoc.Text        = prof.numDocumento;
            txtTelf.Text          = prof.telefono;
            txtEmail.Text         = prof.email;
            txtDireccion.Text     = prof.direccion;
            ddlSexo.SelectedValue = prof.sexo.ToString().Trim();
            txt_fecha.Text        = prof.fechaNacimiento.ToShortDateString();
            lblcodUsuario.Text    = prof.codUsuario.ToString();
            lbl_mensaje_1.Text    = prof.urlFoto;
            if (prof.fechaContrato != null)
            {
                txtContrato.Text = prof.fechaContrato.ToString().Substring(0, 10);
            }
            txtDuracion.Text = prof.duracionContrato.ToString();
            if (prof.latitud != null && prof.longitud != null)
            {
                lblLat.Text = prof.latitud.ToString();
                lblLng.Text = prof.longitud.ToString();

                mostrarDireccion(prof.latitud.ToString(), prof.longitud.ToString());
            }
            if (prof.estadoProfesor == "ACTIVO")
            {
                divEquisdeConOkeyno.Visible = true;
                listarTalleresxProfesor(int.Parse(Session["c"].ToString()));
            }

            string cadDisponibilidad = prof.diasDisponible;

            if (cadDisponibilidad.Contains("L"))
            {
                cblDiasDisponible.Items[0].Selected = true;
            }
            if (cadDisponibilidad.Contains("M"))
            {
                cblDiasDisponible.Items[1].Selected = true;
            }
            if (cadDisponibilidad.Contains("X"))
            {
                cblDiasDisponible.Items[2].Selected = true;
            }
            if (cadDisponibilidad.Contains("J"))
            {
                cblDiasDisponible.Items[3].Selected = true;
            }
            if (cadDisponibilidad.Contains("V"))
            {
                cblDiasDisponible.Items[4].Selected = true;
            }
            if (cadDisponibilidad.Contains("S"))
            {
                cblDiasDisponible.Items[5].Selected = true;
            }

            img_foto.ImageUrl       = lbl_mensaje_1.Text;
            lbl_mensaje_3.Text      = prof.urlCV;
            ddlEstado.SelectedValue = prof.estadoProfesor;

            if (prof.estadoProfesor == "ACTIVO" && string.IsNullOrEmpty(lblcodUsuario.Text))
            {
                divXd.Visible = true;
            }

            int provincia = ctrubig.getProvincia(prof.codDistrito);

            ddlProvincia.SelectedValue = provincia.ToString();
            listarDistritos(provincia);
            ddlDistrito.SelectedValue = prof.codDistrito.ToString();
        }
Ejemplo n.º 7
0
    public void Enviar_Notificacion_y_Correo()
    {
        DtoNotificacion dto_notificacion2 = new DtoNotificacion();
        CtrNotificacion ctr_notificacion2 = new CtrNotificacion();
        CtrPersona      ctr_persona2      = new CtrPersona();

        ctr_persona2.Ctr_SeleccionarUltimaPersonaRegistrada(dto_persona);
        int id_persona = dto_persona.id_persona;

        //Esta notificación es para la persona que fue registrada en el sistema por el admin
        dto_notificacion2.fecha_emision     = System.DateTime.Now;
        dto_notificacion2.clase_visto       = "novisto";
        dto_notificacion2.flg_visto         = "0";
        dto_notificacion2.titulo_color      = "text-success";
        dto_notificacion2.titulo            = "Registro Exitoso";
        dto_notificacion2.mensaje           = "Hola : " + Request.Form["txtNombres"] + " ya eres parte del personal en MiHogar-Perú";
        dto_notificacion2.imagen            = "mihogar-peru.png";
        dto_notificacion2.flg_noti_mostrado = "0";
        dto_notificacion2.id_persona        = id_persona;

        ctr_notificacion2.Ctr_InsertarNotificaciones(dto_notificacion2);


        /*-------------------------MENSAJE DE CORREO----------------------*/

        string nombres      = Request.Form["txtNombres"];
        string apellidos    = Request.Form["txtApellidos"];
        string correo       = Request.Form["txtCorreo"];
        string documento    = Request.Form["txtDocumento"];
        string contra_email = Session["clave_por_email"].ToString();

        System.Net.Mail.MailMessage mmsg = new System.Net.Mail.MailMessage();
        mmsg.To.Add(correo);
        mmsg.Subject         = "Ya eres parte del personal en MiHogar-Perú";
        mmsg.SubjectEncoding = System.Text.Encoding.UTF8;

        //Direccion de correo electronico que queremos que reciba una copia del mensaje
        //mmsg.Bcc.Add("*****@*****.**"); //Opcional

        mmsg.Body = "<div style='margin-top:20px; margin-bottom:20px; margin-right:auto; margin-left:auto; border-style:groove; position:relative; min-height:1px; padding-right:15px; " +
                    "padding-left:15px; -webkit-box-flex:0; -webkit-flex: 0 0 50%; -ms-flex: 0 0 50%; flex: 0 0 50%; max-width:50%;'>" +
                    "<div style='-webkit-box-flex:1; -webkit-flex:1 1 auto; -ms-flex:1 1 auto; flex:1 1 auto; padding:1.25rem'>" +
                    "<div style='background-color:limegreen; margin-top:7px; margin-bottom:17px; padding-top:30px; padding-bottom:30px; align-items:center;'>" +
                    "<h4 style='font-size:45px; margin-top:5px; margin-bottom:5px; color:#fff; text-align:center; font-weight:800;'> MiHogar-Perú </h4>" +
                    "</div>" +

                    "<p style ='margin-bottom:0;'> Hola " + nombres + " " + apellidos + " , ya formas parte del personal administrativo en MiHogar-Perú , tus datos registrados fueron:</p>" +
                    "<div style='margin-top:10px; margin-bottom:10px; margin-right:auto; margin-left:auto; position:relative; width:100%; min-height:1px; padding-right:15px; padding-left:15px; -webkit-box-flex:0;" +
                    "-webkit-flex:0 0 33.333333 %; -ms-flex:0 0 33.333333 %; flex:0 0 33.333333 %; max-width:33.333333 %; -webkit-box-flex: 0;'>" +

                    "<p><span style='color:red;'> Correo : </span> " + correo + "</p>" +
                    "<p><span style='color:red;'> Dni : </span> " + documento + "</p>" +
                    "<p><span style='color:red;'> Clave : </span> " + contra_email + "</p>" +
                    "</div>" +

                    "<p style='margin-bottom:0'>" +
                    "Tus demas datos de información los podras ver ingresando a la página en el panel de usuario y en ´´Mi Información" +
                    "</p>" +

                    "<div style='margin-top:20px; padding-top:10px; padding-bottom:10px; background-color: limegreen;' >" +
                    "</div>" +
                    "</div>" +
                    "</div> ";

        mmsg.BodyEncoding = System.Text.Encoding.UTF8;
        mmsg.IsBodyHtml   = true; //Si no queremos que se envíe como HTML

        mmsg.From = new System.Net.Mail.MailAddress("*****@*****.**");

        /*-------------------------CLIENTE DE CORREO----------------------*/

        System.Net.Mail.SmtpClient cliente = new System.Net.Mail.SmtpClient();

        cliente.Credentials =
            new System.Net.NetworkCredential("*****@*****.**", "elcastito");
        //Lo siguiente es obligatorio si enviamos el mensaje desde Gmail
        cliente.Port      = 25;
        cliente.EnableSsl = true;

        cliente.Host = "smtp.gmail.com"; //Para Gmail "smtp.gmail.com";
                                         /*-------------------------ENVIO DE CORREO----------------------*/
        try
        {
            cliente.Send(mmsg);
        }
        catch (System.Net.Mail.SmtpException ex)
        {
        }
    }