Ejemplo n.º 1
0
        public string EditClave(int UsuarioId, string Clave, int CambiaClave)
        {
            try
            {
                Ws_Generales wsGenerales = new Ws_Generales();
                cn.Open();
                SqlCommand Comando = new SqlCommand("Sp_ChangeClave", cn);
                Comando.CommandType = CommandType.StoredProcedure;
                Comando.Parameters.Add("@UsuarioId", SqlDbType.Int).Value      = UsuarioId;
                Comando.Parameters.Add("@Clave", SqlDbType.VarChar, 200).Value = wsGenerales.Encrypt(Clave);
                Comando.Parameters.Add("@CambiaClave", SqlDbType.Int).Value    = CambiaClave;
                Comando.ExecuteNonQuery();
                cn.Close();

                return("");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public string InsertUsuario(string Nombres, string Apellidos, string Correo, int EmpresaId)
        {
            try
            {
                Ws_Generales wsGenerales = new Ws_Generales();
                cn.Open();
                SqlCommand Comando = new SqlCommand("Sp_Insert_Usuario", cn);
                Comando.CommandType = CommandType.StoredProcedure;
                Comando.Parameters.Add("@Nombres", SqlDbType.VarChar, 200).Value   = Nombres;
                Comando.Parameters.Add("@Apellidos", SqlDbType.VarChar, 200).Value = Apellidos;
                Comando.Parameters.Add("@Correo", SqlDbType.VarChar, 200).Value    = Correo;
                Comando.Parameters.Add("@Clave", SqlDbType.VarChar, 500).Value     = wsGenerales.Encrypt(wsGenerales.GeneraClave());
                Comando.Parameters.Add("@EmpresaId", SqlDbType.Int).Value          = EmpresaId;

                Comando.ExecuteNonQuery();
                cn.Close();

                return("");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Ejemplo n.º 3
0
        public List <DatosUsuario> GetDatosUsuario(string Usuario)
        {
            ds.Tables.Clear();
            Cl_Usuarios  clUsuarios  = new Cl_Usuarios();
            Ws_Generales wsGenerales = new Ws_Generales();

            ds = clUsuarios.GetDatosUsuario(Usuario);
            List <DatosUsuario> Datos = new List <DatosUsuario>();


            foreach (DataRow dr in ds.Tables["DATOS"].Rows)
            {
                DatosUsuario Registro = new DatosUsuario();
                Registro.UsuarioId      = Convert.ToInt32(dr["UsuarioId"]);
                Registro.Nombre         = dr["Nombre"].ToString();
                Registro.PerfilId       = Convert.ToInt32(dr["PerfilId"]);
                Registro.CambiaClave    = Convert.ToInt32(dr["CambiaClave"]);
                Registro.Correo         = dr["Correo"].ToString();
                Registro.Clave          = wsGenerales.Decrypt(dr["Clave"].ToString());
                Registro.EstatusUsuario = Convert.ToInt32(dr["EstatusId"]);
                Datos.Add(Registro);
            }
            return(Datos);
        }