public string InsertUsuario(string Nombres, string Apellidos, string Correo, string Usuario, int PerfilId, int SedeId, string Telefono, int UsuarioId)
        {
            try
            {
                Cl_Usuarios  clUsuarios  = new Cl_Usuarios();
                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("@Usuario", SqlDbType.VarChar, 200).Value   = Usuario;
                Comando.Parameters.Add("@PerfilId", SqlDbType.Int).Value           = PerfilId;
                Comando.Parameters.Add("@SedeId", SqlDbType.Int).Value             = SedeId;
                Comando.Parameters.Add("@Telefono", SqlDbType.VarChar, 200).Value  = Telefono;
                Comando.Parameters.Add("@UsuarioIdCrea", SqlDbType.Int).Value      = UsuarioId;
                Comando.Parameters.Add("@Clave", SqlDbType.VarChar, 500).Value     = wsGenerales.Encrypt(clUsuarios.GeneraClave());

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

                return("");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        public List <ListaUsuarios> GetListaUsuarios()
        {
            ds.Tables.Clear();
            Cl_Usuarios clUsuarios = new Cl_Usuarios();

            ds = clUsuarios.GetListaUsuarios();
            List <ListaUsuarios> Datos = new List <ListaUsuarios>();

            foreach (DataRow dr in ds.Tables["DATOS"].Rows)
            {
                ListaUsuarios Registro = new ListaUsuarios();
                Registro.UsuarioId        = Convert.ToInt32(dr["UsuarioId"]);
                Registro.Nombres          = dr["Nombres"].ToString();
                Registro.SedeId           = Convert.ToInt32(dr["SedeId"]);
                Registro.Sede             = dr["Sede"].ToString();
                Registro.Telefono         = dr["Telefono"].ToString();
                Registro.Correo           = dr["Correo"].ToString();
                Registro.Usuario          = dr["Usuario"].ToString();
                Registro.PerfilId         = Convert.ToInt32(dr["PerfilId"]);
                Registro.Perfil           = dr["Perfil"].ToString();
                Registro.Nombre           = dr["Nombre"].ToString();
                Registro.Apellido         = dr["Apellidos"].ToString();
                Registro.CntIngresos      = Convert.ToInt32(dr["CntIngresos"]);
                Registro.PaisId           = Convert.ToInt32(dr["PaisId"]);
                Registro.EstatusUsuarioId = Convert.ToInt32(dr["EstatusUsuarioId"]);
                Registro.EstatusUsuario   = dr["EstatusUsuario"].ToString();
                Datos.Add(Registro);
            }
            return(Datos);
        }
Example #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);
        }